Skip to content

Commit 5d7f58e

Browse files
KunWuChanstorulf
authored andcommitted
pmdomain: ti: Add a null pointer check to the omap_prm_domain_init
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. Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20240118054257.200814-1-chentao@kylinos.cn Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent e990f3f commit 5d7f58e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/pmdomain/ti/omap_prm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static int omap_prm_domain_init(struct device *dev, struct omap_prm *prm)
695695
data = prm->data;
696696
name = devm_kasprintf(dev, GFP_KERNEL, "prm_%s",
697697
data->name);
698+
if (!name)
699+
return -ENOMEM;
698700

699701
prmd->dev = dev;
700702
prmd->prm = prm;

0 commit comments

Comments
 (0)