RE: [PATCH v3 3/3] iio: temperature: ltc2983: Make use of device properties
From: Sa, Nuno
Date: Thu Mar 03 2022 - 09:52:26 EST
> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Sent: Thursday, March 3, 2022 3:27 PM
> To: Sa, Nuno <Nuno.Sa@xxxxxxxxxx>
> Cc: linux-iio@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Jonathan
> Cameron <jic23@xxxxxxxxxx>; Lars-Peter Clausen <lars@xxxxxxxxxx>
> Subject: Re: [PATCH v3 3/3] iio: temperature: ltc2983: Make use of
> device properties
>
> [External]
>
> On Thu, Mar 03, 2022 at 04:23:34PM +0200, Andy Shevchenko wrote:
> > On Thu, Mar 03, 2022 at 01:31:56PM +0000, Sa, Nuno wrote:
> >
> > ...
> >
> > > > + ref = fwnode_find_reference(child, "adi,cold-junction-
> > > > handle", 0);
> > > > + if (ref) {
> > >
> > > This is nok. It needs to be 'if (IS_ERR(ref))'. We then should return
> > > ERR_CAST() in case of errors inside the if block.
> >
> > This is a good catch!
> >
> > > As this reference
> > > is also optional, we need to nullify ref in case we don't find the
> > > it. Otherwise fwnode_handle_put() breaks.
> >
> > No, this is not correct. fwnode_handle_put() is ERR_PTR aware.
>
> Oh, the ->put() handles that, but the fwnode_call_void_op() doesn't!
>
> This has to be fixed on fwnode level.
Yeah, it was crashing. Even better if you fix there...
- Nuno Sá
> --
> With Best Regards,
> Andy Shevchenko
>