mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()
devm_kstrdup() returns pointer to allocated string on success,
NULL on failure. So it is better to check the return value of it.
Fixes: e35478eac0
("i2c: mux: demux-pinctrl: run properly with multiple instances")
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
This commit is contained in:
parent
2409205acd
commit
7c0195fa9a
1 changed files with 4 additions and 0 deletions
|
@ -243,6 +243,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
|
props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
|
||||||
props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
|
props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
|
||||||
|
if (!props[i].name || !props[i].value) {
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto err_rollback;
|
||||||
|
}
|
||||||
props[i].length = 3;
|
props[i].length = 3;
|
||||||
|
|
||||||
of_changeset_init(&priv->chan[i].chgset);
|
of_changeset_init(&priv->chan[i].chgset);
|
||||||
|
|
Loading…
Reference in a new issue