summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Yang <yiyang13@huawei.com>2023-10-19 06:55:48 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-28 17:14:52 +0000
commit8250fdd1daa320e1576fd29f3e0644eb1327ea35 (patch)
treef5ca13c5d911915cb9f43c9b4b8f16c0032466c5
parent6fc0bc01eef1b377eda67152acc40447d535934f (diff)
mtd: rawnand: meson: check return value of devm_kasprintf()
[ Upstream commit 5a985960a4dd041c21dbe9956958c1633d2da706 ] devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity. Fixes: 1e4d3ba66888 ("mtd: rawnand: meson: fix the clock") Signed-off-by: Yi Yang <yiyang13@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20231019065548.318443-1-yiyang13@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/mtd/nand/raw/meson_nand.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index b10011dec1e6..b16adc0e92e9 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1115,6 +1115,9 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc)
init.name = devm_kasprintf(nfc->dev,
GFP_KERNEL, "%s#div",
dev_name(nfc->dev));
+ if (!init.name)
+ return -ENOMEM;
+
init.ops = &clk_divider_ops;
nfc_divider_parent_data[0].fw_name = "device";
init.parent_data = nfc_divider_parent_data;