public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
@ 2026-02-17  8:05 Andy Shevchenko
  2026-02-17 13:47 ` Nuno Sá
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2026-02-17  8:05 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio, linux-kernel
  Cc: Alisa-Dariana Roman, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Andy Shevchenko, Harshit Mogalapalli

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@oracle.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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;
-
 	indio_dev->name = st->chip_info->name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->info = st->chip_info->info;
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-17  8:05 [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()" Andy Shevchenko
@ 2026-02-17 13:47 ` Nuno Sá
  2026-02-17 15:06   ` Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Nuno Sá @ 2026-02-17 13:47 UTC (permalink / raw)
  To: Andy Shevchenko, Jonathan Cameron, linux-iio, linux-kernel
  Cc: Alisa-Dariana Roman, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Harshit Mogalapalli

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@oracle.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  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.

- Nuno Sá

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-17 13:47 ` Nuno Sá
@ 2026-02-17 15:06   ` Andy Shevchenko
  2026-02-18  9:12     ` Nuno Sá
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2026-02-17 15:06 UTC (permalink / raw)
  To: Nuno Sá
  Cc: Jonathan Cameron, linux-iio, linux-kernel, Alisa-Dariana Roman,
	Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

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@oracle.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  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?
Because what I have heard is that:
- we don't do defensive programming for in-kernel data;
- we don't add a dead code
 (only for the exceptional cases usually accompanied with BUG() or WARN() call).

Both are kernel-wide. Am I mistaken?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-17 15:06   ` Andy Shevchenko
@ 2026-02-18  9:12     ` Nuno Sá
  2026-02-18  9:40       ` Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Nuno Sá @ 2026-02-18  9:12 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, linux-iio, linux-kernel, Alisa-Dariana Roman,
	Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

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@oracle.com>
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  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á

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-18  9:12     ` Nuno Sá
@ 2026-02-18  9:40       ` Andy Shevchenko
  2026-02-18  9:58         ` Jonathan Cameron
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2026-02-18  9:40 UTC (permalink / raw)
  To: Nuno Sá
  Cc: Jonathan Cameron, linux-iio, linux-kernel, Alisa-Dariana Roman,
	Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

On Wed, Feb 18, 2026 at 09:12:03AM +0000, Nuno Sá wrote:
> 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:

...

> > > 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.

Like you said we need clearer policy.

> But again, I'm fine with the above as long as we are consistent from now on.

Exactly!
Jonathan, David, others?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-18  9:40       ` Andy Shevchenko
@ 2026-02-18  9:58         ` Jonathan Cameron
  2026-02-20 10:55           ` Jonathan Cameron
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Cameron @ 2026-02-18  9:58 UTC (permalink / raw)
  To: Andy Shevchenko, Alisa-Dariana Roman
  Cc: Nuno Sá, linux-iio, linux-kernel, Lars-Peter Clausen,
	Michael Hennerich, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Harshit Mogalapalli

On Wed, 18 Feb 2026 11:40:11 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Wed, Feb 18, 2026 at 09:12:03AM +0000, Nuno Sá wrote:
> > 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:  
> 
> ...
> 
> > > > 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.  
> 
> Like you said we need clearer policy.
> 
> > But again, I'm fine with the above as long as we are consistent from now on.  
> 
> Exactly!
> Jonathan, David, others?

As long as no compilers or static analyzers trip up on it and start spouting false warnings,
I'm fine with not checking these. I'm not sure I'm bothered about going through the tree
removing the checks though.   This one is so small I don't mind if it gets copied
into new drivers. If this is all that needs tidying up I'll tweak it whilst applying.

Jonathan


> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-18  9:58         ` Jonathan Cameron
@ 2026-02-20 10:55           ` Jonathan Cameron
  2026-02-20 11:05             ` Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Cameron @ 2026-02-20 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Andy Shevchenko, Alisa-Dariana Roman, Nuno Sá, linux-iio,
	linux-kernel, Lars-Peter Clausen, Michael Hennerich,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

On Wed, 18 Feb 2026 09:58:20 +0000
Jonathan Cameron <jonathan.cameron@huawei.com> wrote:

> On Wed, 18 Feb 2026 11:40:11 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > On Wed, Feb 18, 2026 at 09:12:03AM +0000, Nuno Sá wrote:  
> > > 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:    
> > 
> > ...
> >   
> > > > > 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.    
> > 
> > Like you said we need clearer policy.
> >   
> > > But again, I'm fine with the above as long as we are consistent from now on.    
> > 
> > Exactly!
> > Jonathan, David, others?  
> 
> As long as no compilers or static analyzers trip up on it and start spouting false warnings,
> I'm fine with not checking these. I'm not sure I'm bothered about going through the tree
> removing the checks though.   This one is so small I don't mind if it gets copied
> into new drivers. If this is all that needs tidying up I'll tweak it whilst applying.
> 
Applied.  I also added a link tag to this thread, to say we had
agreed to make it policy in IIO to not have these checks.

Thanks,

Jonathan

> Jonathan
> 
> 
> >   
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-20 10:55           ` Jonathan Cameron
@ 2026-02-20 11:05             ` Andy Shevchenko
  2026-02-22 13:22               ` Jonathan Cameron
  0 siblings, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2026-02-20 11:05 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, Alisa-Dariana Roman, Nuno Sá, linux-iio,
	linux-kernel, Lars-Peter Clausen, Michael Hennerich,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

On Fri, Feb 20, 2026 at 10:55:07AM +0000, Jonathan Cameron wrote:
> On Wed, 18 Feb 2026 09:58:20 +0000
> Jonathan Cameron <jonathan.cameron@huawei.com> wrote:

...

> Applied.  I also added a link tag to this thread, to say we had
> agreed to make it policy in IIO to not have these checks.

Thanks!

Do we still need a process/maintainer-iio.rst?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-20 11:05             ` Andy Shevchenko
@ 2026-02-22 13:22               ` Jonathan Cameron
  2026-02-23  8:45                 ` Andy Shevchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Cameron @ 2026-02-22 13:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, Alisa-Dariana Roman, Nuno Sá, linux-iio,
	linux-kernel, Lars-Peter Clausen, Michael Hennerich,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

On Fri, 20 Feb 2026 13:05:04 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Fri, Feb 20, 2026 at 10:55:07AM +0000, Jonathan Cameron wrote:
> > On Wed, 18 Feb 2026 09:58:20 +0000
> > Jonathan Cameron <jonathan.cameron@huawei.com> wrote:  
> 
> ...
> 
> > Applied.  I also added a link tag to this thread, to say we had
> > agreed to make it policy in IIO to not have these checks.  
> 
> Thanks!
> 
> Do we still need a process/maintainer-iio.rst?
Yes. Been meaning to start drawing one up for a long time but
there is always something else that takes higher priority :(

If you want to propose something as a straw man that would be great!

Jonathan

> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
  2026-02-22 13:22               ` Jonathan Cameron
@ 2026-02-23  8:45                 ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2026-02-23  8:45 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, Alisa-Dariana Roman, Nuno Sá, linux-iio,
	linux-kernel, Lars-Peter Clausen, Michael Hennerich,
	David Lechner, Nuno Sá, Andy Shevchenko, Harshit Mogalapalli

On Sun, Feb 22, 2026 at 01:22:46PM +0000, Jonathan Cameron wrote:
> On Fri, 20 Feb 2026 13:05:04 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > On Fri, Feb 20, 2026 at 10:55:07AM +0000, Jonathan Cameron wrote:
> > > On Wed, 18 Feb 2026 09:58:20 +0000
> > > Jonathan Cameron <jonathan.cameron@huawei.com> wrote:  

...

> > > Applied.  I also added a link tag to this thread, to say we had
> > > agreed to make it policy in IIO to not have these checks.  
> > 
> > Thanks!
> > 
> > Do we still need a process/maintainer-iio.rst?
> Yes. Been meaning to start drawing one up for a long time but
> there is always something else that takes higher priority :(
> 
> If you want to propose something as a straw man that would be great!

Taking into account my constant lack of time and not being a native
speaker I would like somebody else to draft a skeleton. I would be
happy to throw ideas how to amend and/or extend it.

OTOH, somebody like David, knowing more about depth of the IIO and
the style can also draft if he feels like doing it. David?

At least, existence of that document drops quite a burden of repeating
something which can only be scrapped now from the ML archives and
IIO existing drivers (taking the date of pulling it in the upstream,
the newer the better).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-02-23  8:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17  8:05 [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()" Andy Shevchenko
2026-02-17 13:47 ` Nuno Sá
2026-02-17 15:06   ` Andy Shevchenko
2026-02-18  9:12     ` Nuno Sá
2026-02-18  9:40       ` Andy Shevchenko
2026-02-18  9:58         ` Jonathan Cameron
2026-02-20 10:55           ` Jonathan Cameron
2026-02-20 11:05             ` Andy Shevchenko
2026-02-22 13:22               ` Jonathan Cameron
2026-02-23  8:45                 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox