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: 1e4d3ba668 ("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>
This commit is contained in:
parent
b2a9ba69df
commit
5ee813da0c
1 changed files with 3 additions and 0 deletions
|
|
@ -1021,6 +1021,9 @@ static int meson_nfc_clk_init(struct meson_nfc *nfc)
|
||||||
init.name = devm_kasprintf(nfc->dev,
|
init.name = devm_kasprintf(nfc->dev,
|
||||||
GFP_KERNEL, "%s#div",
|
GFP_KERNEL, "%s#div",
|
||||||
dev_name(nfc->dev));
|
dev_name(nfc->dev));
|
||||||
|
if (!init.name)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
init.ops = &clk_divider_ops;
|
init.ops = &clk_divider_ops;
|
||||||
nfc_divider_parent_data[0].fw_name = "device";
|
nfc_divider_parent_data[0].fw_name = "device";
|
||||||
init.parent_data = nfc_divider_parent_data;
|
init.parent_data = nfc_divider_parent_data;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue