Re: [PATCH next] iio: sca3000: simplify with spi_get_device_match_data()

From: Andy Shevchenko

Date: Tue Feb 17 2026 - 02:49:55 EST


On Mon, Feb 16, 2026 at 03:45:34PM +0530, Harshit Mogalapalli wrote:
> On 16/02/26 15:33, Andy Shevchenko wrote:
> > On Mon, Feb 16, 2026 at 01:51:05AM -0800, Harshit Mogalapalli wrote:

...

> > > - st->info = &sca3000_spi_chip_info_tbl[spi_get_device_id(spi)
> > > - ->driver_data];
> > > + st->info = spi_get_device_match_data(spi);
> >
> > > + if (!st->info)
> > > + return -EINVAL;
> >
> > This is a dead check. Just make it a requirement and drop dead code.
> > The support of a new HW will be assumed not tested at all if there
> > is no driver_data.
>
> I agree, will drop the check in V2.
>
> There are a few commits like this which added NULL checks, so I was not
> fully sure.
>
> commit: c5d8facf107a ("iio: adc: ad7192: properly check
> spi_get_device_match_data()")

Nice catch!

That change is unneeded churn that adds a dead code as it looks like.
Nuno, can you elaborate the motivation behind that?

--
With Best Regards,
Andy Shevchenko