Skip to content

Commit

Permalink
mtd: rawnand: meson: check return value of devm_kasprintf()
Browse files Browse the repository at this point in the history
[ Upstream commit 5a98596 ]

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: 1e4d3ba ("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>
  • Loading branch information
Yi Yang authored and gregkh committed Nov 28, 2023
1 parent 6fc0bc0 commit 8250fdd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/nand/raw/meson_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8250fdd

Please sign in to comment.