Skip to content

Commit 5a98596

Browse files
Yi Yangmiquelraynal
authored andcommitted
mtd: rawnand: meson: check return value of devm_kasprintf()
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 74ac5b5 commit 5a98596

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mtd/nand/raw/meson_nand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,9 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc)
11341134
init.name = devm_kasprintf(nfc->dev,
11351135
GFP_KERNEL, "%s#div",
11361136
dev_name(nfc->dev));
1137+
if (!init.name)
1138+
return -ENOMEM;
1139+
11371140
init.ops = &clk_divider_ops;
11381141
nfc_divider_parent_data[0].fw_name = "device";
11391142
init.parent_data = nfc_divider_parent_data;

0 commit comments

Comments
 (0)