From: Jonathan Cameron <jic23@kernel.org>
To: Nuno Sa <nuno.sa@analog.com>
Cc: <linux-iio@vger.kernel.org>,
Alisa-Dariana Roman <alisa.roman@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>
Subject: Re: [PATCH] iio: adc: ad7192: properly check spi_get_device_match_data()
Date: Sat, 19 Oct 2024 15:01:45 +0100 [thread overview]
Message-ID: <20241019150145.07fcda7d@jic23-huawei> (raw)
In-Reply-To: <20241014-fix-error-check-v1-1-089e1003d12f@analog.com>
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á
>
prev parent reply other threads:[~2024-10-19 14:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241019150145.07fcda7d@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=alisa.roman@analog.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox