Commit 7c0195fa authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Wolfram Sang

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: e35478ea ("i2c: mux: demux-pinctrl: run properly with multiple instances")
Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 2409205a
......@@ -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].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
if (!props[i].name || !props[i].value) {
err = -ENOMEM;
goto err_rollback;
}
props[i].length = 3;
of_changeset_init(&priv->chan[i].chgset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment