diff options
author | Nuno Sa <nuno.sa@analog.com> | 2024-10-14 17:01:21 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2024-10-21 19:19:25 +0100 |
commit | b7f99fa1b64af2f696b13cec581cb4cd7d3982b8 (patch) | |
tree | fd187ba132cbce0b9ff8966b54e41daa6ce63ab6 | |
parent | b65249a7b362fc9efeead21160a15f9b157e13ad (diff) |
iio: adc: ad7192: properly check spi_get_device_match_data()
spi_get_device_match_data() can return a NULL pointer. Hence, let's
check for it.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20241014-fix-error-check-v1-1-089e1003d12f@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/adc/ad7192.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index 7042ddfdfc03..955e9eff0099 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -1394,6 +1394,9 @@ static int ad7192_probe(struct spi_device *spi) st->int_vref_mv = ret == -ENODEV ? avdd_mv : ret / MILLI; st->chip_info = spi_get_device_match_data(spi); + if (!st->chip_info) + return -ENODEV; + indio_dev->name = st->chip_info->name; indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = st->chip_info->info; |