Re: [PATCH] iio:dac:ad3552r: Fix an IS_ERR() vs NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 4 Apr 2022 12:34:25 +0000
"Sa, Nuno" <Nuno.Sa@xxxxxxxxxx> wrote:

> > From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > Sent: Monday, April 4, 2022 1:43 PM
> > To: Lars-Peter Clausen <lars@xxxxxxxxxx>
> > Cc: Hennerich, Michael <Michael.Hennerich@xxxxxxxxxx>; Jonathan
> > Cameron <jic23@xxxxxxxxxx>; linux-iio@xxxxxxxxxxxxxxx; Sa, Nuno
> > <Nuno.Sa@xxxxxxxxxx>; kernel-janitors@xxxxxxxxxxxxxxx
> > Subject: [PATCH] iio:dac:ad3552r: Fix an IS_ERR() vs NULL check
> > 
> > [External]
> > 
> > The fwnode_get_named_child_node() function does not return error
> > pointers.  It returns NULL.  Update the check accordingly.
> > 
> > Fixes: 8f2b54824b28 ("drivers:iio:dac: Add AD3552R driver support")
> > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > ---  
> 
> Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> 
> >  drivers/iio/dac/ad3552r.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c
> > index 97f13c0b9631..59f49b7564b2 100644
> > --- a/drivers/iio/dac/ad3552r.c
> > +++ b/drivers/iio/dac/ad3552r.c
> > @@ -809,10 +809,10 @@ static int
> > ad3552r_configure_custom_gain(struct ad3552r_desc *dac,
> > 
> >  	gain_child = fwnode_get_named_child_node(child,
> >  						 "custom-output-range-
> > config");
> > -	if (IS_ERR(gain_child)) {
> > +	if (!gain_child) {
> >  		dev_err(dev,
> >  			"mandatory custom-output-range-config
> > property missing\n");
> > -		return PTR_ERR(gain_child);
> > +		return -EINVAL;
> >  	}
> > 
> >  	dac->ch_data[ch].range_override = 1;
> > --
> > 2.20.1  
> 





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux