* [PATCH] iio: adc: ad7192: properly check spi_get_device_match_data()
@ 2024-10-14 15:01 Nuno Sa
2024-10-19 14:01 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Nuno Sa @ 2024-10-14 15:01 UTC (permalink / raw)
To: linux-iio
Cc: Alisa-Dariana Roman, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron
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>
---
drivers/iio/adc/ad7192.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 7042ddfdfc03ee5ea58ca07fb1943feb6538175b..955e9eff0099e5c91491ca5b1f836534ac0db2f9 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;
---
base-commit: 465644ac29536d10178b5ca4684d0b84765b9fa4
change-id: 20241014-fix-error-check-d34fde9780a2
--
Thanks!
- Nuno Sá
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: adc: ad7192: properly check spi_get_device_match_data()
2024-10-14 15:01 [PATCH] iio: adc: ad7192: properly check spi_get_device_match_data() Nuno Sa
@ 2024-10-19 14:01 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-10-19 14:01 UTC (permalink / raw)
To: Nuno Sa
Cc: linux-iio, Alisa-Dariana Roman, Lars-Peter Clausen,
Michael Hennerich
On Mon, 14 Oct 2024 17:01:21 +0200
Nuno Sa <nuno.sa@analog.com> wrote:
> 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>
Applied.
> ---
> drivers/iio/adc/ad7192.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 7042ddfdfc03ee5ea58ca07fb1943feb6538175b..955e9eff0099e5c91491ca5b1f836534ac0db2f9 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;
>
> ---
> base-commit: 465644ac29536d10178b5ca4684d0b84765b9fa4
> change-id: 20241014-fix-error-check-d34fde9780a2
> --
>
> Thanks!
> - Nuno Sá
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-19 14:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 15:01 [PATCH] iio: adc: ad7192: properly check spi_get_device_match_data() Nuno Sa
2024-10-19 14:01 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox