diff mbox series

iio: adc: xilinx: check return value of xadc_write_adc_reg

Message ID 20181227195454.26344-1-pakki001@umn.edu (mailing list archive)
State New, archived
Headers show
Series iio: adc: xilinx: check return value of xadc_write_adc_reg | expand

Commit Message

Aditya Pakki Dec. 27, 2018, 7:54 p.m. UTC
In function xadc_probe, xadc_write_adc_reg can return an error value
when write fails. The fix checks for the return value consistent with
other invocations of the latter function.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 drivers/iio/adc/xilinx-xadc-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michal Simek Jan. 3, 2019, 11:16 a.m. UTC | #1
On 27. 12. 18 20:54, Aditya Pakki wrote:
> In function xadc_probe, xadc_write_adc_reg can return an error value
> when write fails. The fix checks for the return value consistent with
> other invocations of the latter function.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  drivers/iio/adc/xilinx-xadc-core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index 3f6be5ac049a..b13c61539d46 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -1273,8 +1273,10 @@ static int xadc_probe(struct platform_device *pdev)
>  			xadc->threshold[i] = 0xffff;
>  		else
>  			xadc->threshold[i] = 0;
> -		xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
> +		ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
>  			xadc->threshold[i]);
> +		if (ret)
> +			goto err_free_irq;
>  	}
>  
>  	/* Go to non-buffered mode */
> 

Reviewed-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal
Jonathan Cameron Jan. 5, 2019, 4:45 p.m. UTC | #2
On Thu, 3 Jan 2019 12:16:49 +0100
Michal Simek <michal.simek@xilinx.com> wrote:

> On 27. 12. 18 20:54, Aditya Pakki wrote:
> > In function xadc_probe, xadc_write_adc_reg can return an error value
> > when write fails. The fix checks for the return value consistent with
> > other invocations of the latter function.
> > 
> > Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> > ---
> >  drivers/iio/adc/xilinx-xadc-core.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> > index 3f6be5ac049a..b13c61539d46 100644
> > --- a/drivers/iio/adc/xilinx-xadc-core.c
> > +++ b/drivers/iio/adc/xilinx-xadc-core.c
> > @@ -1273,8 +1273,10 @@ static int xadc_probe(struct platform_device *pdev)
> >  			xadc->threshold[i] = 0xffff;
> >  		else
> >  			xadc->threshold[i] = 0;
> > -		xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
> > +		ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
> >  			xadc->threshold[i]);
> > +		if (ret)
> > +			goto err_free_irq;
> >  	}
> >  
> >  	/* Go to non-buffered mode */
> >   
> 
> Reviewed-by: Michal Simek <michal.simek@xilinx.com>
> 
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> Thanks,
> Michal
diff mbox series

Patch

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 3f6be5ac049a..b13c61539d46 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1273,8 +1273,10 @@  static int xadc_probe(struct platform_device *pdev)
 			xadc->threshold[i] = 0xffff;
 		else
 			xadc->threshold[i] = 0;
-		xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
+		ret = xadc_write_adc_reg(xadc, XADC_REG_THRESHOLD(i),
 			xadc->threshold[i]);
+		if (ret)
+			goto err_free_irq;
 	}
 
 	/* Go to non-buffered mode */