public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: "Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Alisa-Dariana Roman" <alisa.roman@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Harshit Mogalapalli" <harshit.m.mogalapalli@oracle.com>
Subject: Re: [PATCH v1 1/1] iio: adc: ad7192: Revert "properly check spi_get_device_match_data()"
Date: Tue, 17 Feb 2026 17:06:35 +0200	[thread overview]
Message-ID: <aZSD-3WIVwT6XYWX@smile.fi.intel.com> (raw)
In-Reply-To: <aebc2f13040d97e6e3b9797d3fa580198125e3f5.camel@gmail.com>

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



  reply	other threads:[~2026-02-17 15:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=aZSD-3WIVwT6XYWX@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alisa.roman@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --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