Skip to content

Commit 825906f

Browse files
KunWuChanlag-linaro
authored andcommitted
mfd: tps6594: Add null pointer check to tps6594_device_init()
devm_kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Fixes: 325bec7 ("mfd: tps6594: Add driver for TI TPS6594 PMIC") Suggested-by: Lee Jones <lee@kernel.org> Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20231208033320.49345-1-chentao@kylinos.cn Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 4f9b632 commit 825906f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/mfd/tps6594-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
433433
tps6594_irq_chip.name = devm_kasprintf(dev, GFP_KERNEL, "%s-%ld-0x%02x",
434434
dev->driver->name, tps->chip_id, tps->reg);
435435

436+
if (!tps6594_irq_chip.name)
437+
return -ENOMEM;
438+
436439
ret = devm_regmap_add_irq_chip(dev, tps->regmap, tps->irq, IRQF_SHARED | IRQF_ONESHOT,
437440
0, &tps6594_irq_chip, &tps->irq_data);
438441
if (ret)

0 commit comments

Comments
 (0)