Skip to content

Commit

Permalink
iio: adc: ad7192: properly check spi_get_device_match_data()
Browse files Browse the repository at this point in the history
spi_get_device_match_data() can return a NULL pointer. Hence, let's
check for it.

Signed-off-by: Nuno Sa <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
nunojsa authored and jic23 committed Oct 21, 2024
1 parent b65249a commit b7f99fa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/iio/adc/ad7192.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b7f99fa

Please sign in to comment.