[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220302080342.71803-1-jiasheng@iscas.ac.cn>
Date: Wed, 2 Mar 2022 16:03:42 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: wsa+renesas@...g-engineering.com, peda@...ntia.se
Cc: linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] i2c: mux: demux-pinctrl: Handle error for devm_kstrdup
As the potential failure of the devm_kstrdup(),
it should be better to check it and return error
if fails.
Fixes: e35478eac030 ("i2c: mux: demux-pinctrl: run properly with multiple instances")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/i2c/muxes/i2c-demux-pinctrl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index 5365199a31f4..3203361b00f2 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);
--
2.25.1
Powered by blists - more mailing lists