Re: [PATCH v8 2/8] iio: dac: ad5686: missing NULL check on match data

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-hardening,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Fri, Jul 17, 2026 at 10:31:26AM +0100, Rodrigo Alencar wrote:
> On 17/07/26 11:15, Andy Shevchenko wrote:
> > On Fri, Jul 17, 2026 at 07:51:35AM +0100, Rodrigo Alencar wrote:
> > > On 16/07/26 21:42, Andy Shevchenko wrote:
> > > > On Thu, Jul 16, 2026 at 01:14:18PM +0100, Rodrigo Alencar via B4 Relay wrote:

...

> > > > >  	struct iio_dev *indio_dev;
> > > > >  	int ret, i;
> > > > 
> > > > Move an assignment here as well.
> > > > 
> > > > 	chip_info = ...
> > > 
> > > assignment? this is an input param validation
> > 
> > Can we make sure we always get a correct one to begin with?
> > With that an assignment and check can be coupled together.
> > Also consider use -ENODATA as it's most likely comes from
> > driver_data.
> 
> I suppose you are suggesting to move the check to the bus code with:
> 
> 	info = i2c_get_match_data(i2c);
> 	if (!info)
> 		return -ENODATA;
> 
> rather than here in the core/common code.

Yes! This avoids layering violation and makes the API contract cleaner.

> > > > > +	if (!chip_info)
> > > > > +		return -ENODEV;

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.