Linux-IIO Archive on lore.kernel.org
 help / Atom feed
* [PATCH] iio: adc: xilinx: check return value of xadc_write_adc_reg
@ 2018-12-27 19:54 Aditya Pakki
  2019-01-03 11:16 ` Michal Simek
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Pakki @ 2018-12-27 19:54 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Michal Simek, Manish Narani, linux-iio,
	linux-arm-kernel, linux-kernel

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 */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: xilinx: check return value of xadc_write_adc_reg
  2018-12-27 19:54 [PATCH] iio: adc: xilinx: check return value of xadc_write_adc_reg Aditya Pakki
@ 2019-01-03 11:16 ` Michal Simek
  2019-01-05 16:45   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Simek @ 2019-01-03 11:16 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Michal Simek, Manish Narani, linux-iio,
	linux-arm-kernel, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: adc: xilinx: check return value of xadc_write_adc_reg
  2019-01-03 11:16 ` Michal Simek
@ 2019-01-05 16:45   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2019-01-05 16:45 UTC (permalink / raw)
  To: Michal Simek
  Cc: Aditya Pakki, kjlu, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Manish Narani, linux-iio,
	linux-arm-kernel, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27 19:54 [PATCH] iio: adc: xilinx: check return value of xadc_write_adc_reg Aditya Pakki
2019-01-03 11:16 ` Michal Simek
2019-01-05 16:45   ` Jonathan Cameron

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org linux-iio@archiver.kernel.org
	public-inbox-index linux-iio


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox