diff options
author | Xiaoke Wang <xkernel.wang@foxmail.com> | 2022-03-03 13:39:14 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2023-09-20 23:26:37 +0200 |
commit | 7c0195fa9a9e263df204963f88a22b21688ffb66 (patch) | |
tree | b2c46599bb8953d63d4f270c9a8d68737d680be8 /drivers/i2c | |
parent | i2c: designware: fix __i2c_dw_disable() in case master is holding SCL low (diff) | |
download | linux-7c0195fa9a9e263df204963f88a22b21688ffb66.tar.xz linux-7c0195fa9a9e263df204963f88a22b21688ffb66.zip |
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: e35478eac030 ("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>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/muxes/i2c-demux-pinctrl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c index a3a122fae71e..22f2280eab7f 100644 --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c @@ -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); |