Re: [PATCH v8 2/8] iio: dac: ad5686: missing NULL check on match data
From: Joshua Crofts
Date: Thu Jul 16 2026 - 09:17:14 EST
On Thu, 16 Jul 2026 13:14:18 +0100
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:
> From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
>
> Verify that chip_info pointer is not NULL. If a user binds the driver
> using driver_override via sysfs with a device name not present in the
> id_table or of_match_table, match data will be NULL.
>
> Fixes: 0eb1728461a1 ("iio: dac: ad5686: drop enum id")
> Reported-by: sashiko-bot@xxxxxxxxxx
> Closes: https://lore.kernel.org/all/20260710113149.53EC51F000E9@xxxxxxxxxxxxxxx/
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
> ---
> drivers/iio/dac/ad5686.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index 713fe71ad1e7..d34250647aa4 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
> @@ -479,6 +479,9 @@ int ad5686_probe(struct device *dev,
> struct iio_dev *indio_dev;
> int ret, i;
>
> + if (!chip_info)
> + return -ENODEV;
> +
> indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
> if (indio_dev == NULL)
> return -ENOMEM;
>
LGTM.
Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
--
Kind regards
CJD