Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"

From: Nuno Sá

Date: Wed Feb 18 2026 - 04:13:16 EST


On Tue, 2026-02-17 at 17:06 +0200, Andy Shevchenko wrote:
> On Tue, Feb 17, 2026 at 01:47:59PM +0000, Nuno Sá wrote:
> > On Tue, 2026-02-17 at 09:05 +0100, Andy Shevchenko wrote:
> > > This reverts commit b7f99fa1b64af2f696b13cec581cb4cd7d3982b8.
> > >
> > > The added code is currently a dead code. Moreover, the driver is not
> > > designed to have any defaults effectively making driver data a mandatory
> > > information to work with. Taking all together, revert unneeded change.
> > >
> > > Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > > ---
> > >  drivers/iio/adc/ad7192.c | 3 ---
> > >  1 file changed, 3 deletions(-)
> > >
> > > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> > > index 530e1d307860..8b1664f6b102 100644
> > > --- a/drivers/iio/adc/ad7192.c
> > > +++ b/drivers/iio/adc/ad7192.c
> > > @@ -1402,9 +1402,6 @@ 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;
> >
> > I'm ok with this but as long as we get some consistency agreed on. So far,
> > IIRC, the policy was to check for the NULL case even for the cases where that
> > was not possible to happen.
>
> Is it kernel-wide policy?

Nope... Just IIO IIRC. Actually, I'm pretty sure we had patches in the past just adding the
check. But again, I'm fine with the above as long as we are consistent from now on.

- Nuno Sá