[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_0F8E090AA07050A5857F1E9067E6B9DC0C07@qq.com>
Date: Sun, 16 Jan 2022 13:34:50 +0800
From: xkernel.wang@...mail.com
To: srinivas.kandagatla@...aro.org, narmstrong@...libre.com,
khilman@...libre.com
Cc: jbrunet@...libre.com, martin.blumenstingl@...glemail.com,
linux-arm-kernel@...ts.infradead.org,
linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org,
Xiaoke Wang <xkernel.wang@...mail.com>
Subject: [PATCH] nvmem: meson-mx-efuse: check the return value of devm_kstrdup()
From: Xiaoke Wang <xkernel.wang@...mail.com>
devm_kstrdup() returns pointer to allocated string on success,
NULL on failure. So it is better to check the return value of it.
Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
---
drivers/nvmem/meson-mx-efuse.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvmem/meson-mx-efuse.c b/drivers/nvmem/meson-mx-efuse.c
index 07c9f38..38e6a5f 100644
--- a/drivers/nvmem/meson-mx-efuse.c
+++ b/drivers/nvmem/meson-mx-efuse.c
@@ -211,6 +211,9 @@ static int meson_mx_efuse_probe(struct platform_device *pdev)
efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name,
GFP_KERNEL);
+ if (!efuse->config.name)
+ return -ENOMEM;
+
efuse->config.owner = THIS_MODULE;
efuse->config.dev = &pdev->dev;
efuse->config.priv = efuse;
--
Powered by blists - more mailing lists