aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Han <[email protected]>2024-11-18 17:02:08 +0800
committerJonathan Cameron <[email protected]>2024-12-07 17:23:41 +0000
commitbcb394bb28e55312cace75362b8e489eb0e02a30 (patch)
tree06e1f1c80d0fc75f0e40b0039c849e9cede43cb7
parentad8479ac083b841da42975d79288b25c088c5cc3 (diff)
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: 00ef7708fa60 ("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]>
-rw-r--r--drivers/iio/adc/ti-ads1298.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/adc/ti-ads1298.c b/drivers/iio/adc/ti-ads1298.c
index 36d43495f603..03f762415fa5 100644
--- a/drivers/iio/adc/ti-ads1298.c
+++ b/drivers/iio/adc/ti-ads1298.c
@@ -613,6 +613,8 @@ static int ads1298_init(struct iio_dev *indio_dev)
}
indio_dev->name = devm_kasprintf(dev, GFP_KERNEL, "ads129%u%s",
indio_dev->num_channels, suffix);
+ if (!indio_dev->name)
+ return -ENOMEM;
/* Enable internal test signal, double amplitude, double frequency */
ret = regmap_write(priv->regmap, ADS1298_REG_CONFIG2,