Skip to content

Commit bcb394b

Browse files
Charles Hanjic23
authored andcommitted
iio: adc: ti-ads1298: Add NULL check in ads1298_init
devm_kasprintf() can return a NULL pointer on failure. A check on the return value of such a call in ads1298_init() is missing. Add it. Fixes: 00ef770 ("iio: adc: ti-ads1298: Add driver") Signed-off-by: Charles Han <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent ad8479a commit bcb394b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/adc/ti-ads1298.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,8 @@ static int ads1298_init(struct iio_dev *indio_dev)
613613
}
614614
indio_dev->name = devm_kasprintf(dev, GFP_KERNEL, "ads129%u%s",
615615
indio_dev->num_channels, suffix);
616+
if (!indio_dev->name)
617+
return -ENOMEM;
616618

617619
/* Enable internal test signal, double amplitude, double frequency */
618620
ret = regmap_write(priv->regmap, ADS1298_REG_CONFIG2,

0 commit comments

Comments
 (0)