aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKunwu Chan <[email protected]>2023-12-08 11:33:20 +0800
committerLee Jones <[email protected]>2023-12-13 15:52:59 +0000
commit825906f2ebe83977d747d8bce61675dddd72485d (patch)
tree50052f780f762dd83bd18c8b2a5dd9fa4f331d33
parent4f9b632e1bb28e0b5ec6d63a51ea727ce0581ec0 (diff)
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: 325bec7157b3 ("mfd: tps6594: Add driver for TI TPS6594 PMIC") Suggested-by: Lee Jones <[email protected]> Signed-off-by: Kunwu Chan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
-rw-r--r--drivers/mfd/tps6594-core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mfd/tps6594-core.c b/drivers/mfd/tps6594-core.c
index 0fb9c5cf213a..783ee59901e8 100644
--- a/drivers/mfd/tps6594-core.c
+++ b/drivers/mfd/tps6594-core.c
@@ -433,6 +433,9 @@ int tps6594_device_init(struct tps6594 *tps, bool enable_crc)
tps6594_irq_chip.name = devm_kasprintf(dev, GFP_KERNEL, "%s-%ld-0x%02x",
dev->driver->name, tps->chip_id, tps->reg);
+ if (!tps6594_irq_chip.name)
+ return -ENOMEM;
+
ret = devm_regmap_add_irq_chip(dev, tps->regmap, tps->irq, IRQF_SHARED | IRQF_ONESHOT,
0, &tps6594_irq_chip, &tps->irq_data);
if (ret)