Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0926a2b7 authored by Xiaoke Wang's avatar Xiaoke Wang Committed by Greg Kroah-Hartman
Browse files

i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()



[ Upstream commit 7c0195fa9a9e263df204963f88a22b21688ffb66 ]

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>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e09db461
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);