linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv
@ 2012-12-14  7:47 Axel Lin
  2012-12-14  7:48 ` [PATCH 2/6] iio: dac: ad5380: Don't set error code to st->vref Axel Lin
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Axel Lin @ 2012-12-14  7:47 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Lars-Peter Clausen, linux-iio, linux-kernel

regulator_get_voltage() may return negative error code.
Add error checking to avoid setting error code to st->vref_uv.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/iio/adc/ad7266.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index a6f4fc5..e36107d 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -411,7 +411,11 @@ static int __devinit ad7266_probe(struct spi_device *spi)
 		if (ret)
 			goto error_put_reg;
 
-		st->vref_uv = regulator_get_voltage(st->reg);
+		ret = regulator_get_voltage(st->reg);
+		if (ret < 0)
+			goto error_disable_reg;
+
+		st->vref_uv = ret;
 	} else {
 		/* Use internal reference */
 		st->vref_uv = 2500000;
-- 
1.7.9.5




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

* [PATCH 2/6] iio: dac: ad5380: Don't set error code to st->vref
  2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
@ 2012-12-14  7:48 ` Axel Lin
  2012-12-14  7:51 ` [PATCH 3/6] iio: dac: ad5504: Don't set error code to voltage_uv Axel Lin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-12-14  7:48 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Lars-Peter Clausen, linux-iio, linux-kernel

regulator_get_voltage() may return negative error code.
Add error checking to avoid setting error code to st->vref_uv.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/iio/dac/ad5380.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c
index 14991ac..4aca189 100644
--- a/drivers/iio/dac/ad5380.c
+++ b/drivers/iio/dac/ad5380.c
@@ -406,7 +406,11 @@ static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap,
 			goto error_free_reg;
 		}
 
-		st->vref = regulator_get_voltage(st->vref_reg);
+		ret = regulator_get_voltage(st->vref_reg);
+		if (ret < 0)
+			goto error_disable_reg;
+
+		st->vref = ret;
 	} else {
 		st->vref = st->chip_info->int_vref;
 		ctrl |= AD5380_CTRL_INT_VREF_EN;
-- 
1.7.9.5




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

* [PATCH 3/6] iio: dac: ad5504: Don't set error code to voltage_uv
  2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
  2012-12-14  7:48 ` [PATCH 2/6] iio: dac: ad5380: Don't set error code to st->vref Axel Lin
@ 2012-12-14  7:51 ` Axel Lin
  2012-12-14  7:52 ` [PATCH 4/6] iio: dac: ad5624r_spi: " Axel Lin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-12-14  7:51 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Michael Hennerich, linux-iio, linux-kernel

regulator_get_voltage() may return negative error code.
Add error checking to avoid setting error code to voltage_uv.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/iio/dac/ad5504.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 242bdc7..1e9a1f4 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -296,7 +296,11 @@ static int __devinit ad5504_probe(struct spi_device *spi)
 		if (ret)
 			goto error_put_reg;
 
-		voltage_uv = regulator_get_voltage(reg);
+		ret = regulator_get_voltage(reg);
+		if (ret)
+			goto error_disable_reg;
+
+		voltage_uv = ret;
 	}
 
 	spi_set_drvdata(spi, indio_dev);
-- 
1.7.9.5




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

* [PATCH 4/6] iio: dac: ad5624r_spi: Don't set error code to voltage_uv
  2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
  2012-12-14  7:48 ` [PATCH 2/6] iio: dac: ad5380: Don't set error code to st->vref Axel Lin
  2012-12-14  7:51 ` [PATCH 3/6] iio: dac: ad5504: Don't set error code to voltage_uv Axel Lin
@ 2012-12-14  7:52 ` Axel Lin
  2012-12-14  7:54 ` [PATCH 5/6] iio: dac: ad5686: " Axel Lin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-12-14  7:52 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Barry Song, linux-iio, linux-kernel

regulator_get_voltage() may return negative error code.
Add error checking to avoid setting error code to voltage_uv.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/iio/dac/ad5624r_spi.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
index 6a7d6a4..ae7fb64 100644
--- a/drivers/iio/dac/ad5624r_spi.c
+++ b/drivers/iio/dac/ad5624r_spi.c
@@ -238,7 +238,11 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
 		if (ret)
 			goto error_put_reg;
 
-		voltage_uv = regulator_get_voltage(st->reg);
+		ret = regulator_get_voltage(st->reg);
+		if (ret)
+			goto error_disable_reg;
+
+		voltage_uv = ret;
 	}
 
 	spi_set_drvdata(spi, indio_dev);
-- 
1.7.9.5




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

* [PATCH 5/6] iio: dac: ad5686: Don't set error code to voltage_uv
  2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
                   ` (2 preceding siblings ...)
  2012-12-14  7:52 ` [PATCH 4/6] iio: dac: ad5624r_spi: " Axel Lin
@ 2012-12-14  7:54 ` Axel Lin
  2012-12-14  7:55 ` [PATCH 6/6] iio: dac: ad5791: Don't set error code to [pos|neg]_voltage_uv Axel Lin
  2012-12-14  9:56 ` [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Lars-Peter Clausen
  5 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-12-14  7:54 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Michael Hennerich, linux-iio, linux-kernel

regulator_get_voltage() may return negative error code.
Add error checking to avoid setting error code to voltage_uv.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/iio/dac/ad5686.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index bc92ff9..28f2e59 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -332,7 +332,11 @@ static int __devinit ad5686_probe(struct spi_device *spi)
 		if (ret)
 			goto error_put_reg;
 
-		voltage_uv = regulator_get_voltage(st->reg);
+		ret = regulator_get_voltage(st->reg);
+		if (ret)
+			goto error_disable_reg;
+
+		voltage_uv = ret;
 	}
 
 	st->chip_info =
-- 
1.7.9.5




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

* [PATCH 6/6] iio: dac: ad5791: Don't set error code to [pos|neg]_voltage_uv
  2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
                   ` (3 preceding siblings ...)
  2012-12-14  7:54 ` [PATCH 5/6] iio: dac: ad5686: " Axel Lin
@ 2012-12-14  7:55 ` Axel Lin
  2012-12-14  9:56 ` [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Lars-Peter Clausen
  5 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-12-14  7:55 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Michael Hennerich, linux-iio, linux-kernel

regulator_get_voltage() may return negative error code.
Don't set error code to to pos_voltage_uv and neg_voltage_uv.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/iio/dac/ad5791.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index 2bd2e37..6efe83e 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -365,7 +365,11 @@ static int __devinit ad5791_probe(struct spi_device *spi)
 		if (ret)
 			goto error_put_reg_pos;
 
-		pos_voltage_uv = regulator_get_voltage(st->reg_vdd);
+		ret = regulator_get_voltage(st->reg_vdd);
+		if (ret < 0)
+			goto error_disable_reg_pos;
+
+		pos_voltage_uv = ret;
 	}
 
 	st->reg_vss = regulator_get(&spi->dev, "vss");
@@ -374,7 +378,11 @@ static int __devinit ad5791_probe(struct spi_device *spi)
 		if (ret)
 			goto error_put_reg_neg;
 
-		neg_voltage_uv = regulator_get_voltage(st->reg_vss);
+		ret = regulator_get_voltage(st->reg_vss);
+		if (ret < 0)
+			goto error_disable_reg_neg;
+
+		neg_voltage_uv = ret;
 	}
 
 	st->pwr_down = true;
@@ -428,6 +436,7 @@ error_put_reg_neg:
 	if (!IS_ERR(st->reg_vss))
 		regulator_put(st->reg_vss);
 
+error_disable_reg_pos:
 	if (!IS_ERR(st->reg_vdd))
 		regulator_disable(st->reg_vdd);
 error_put_reg_pos:
-- 
1.7.9.5




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

* Re: [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv
  2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
                   ` (4 preceding siblings ...)
  2012-12-14  7:55 ` [PATCH 6/6] iio: dac: ad5791: Don't set error code to [pos|neg]_voltage_uv Axel Lin
@ 2012-12-14  9:56 ` Lars-Peter Clausen
  5 siblings, 0 replies; 7+ messages in thread
From: Lars-Peter Clausen @ 2012-12-14  9:56 UTC (permalink / raw)
  To: Axel Lin; +Cc: Jonathan Cameron, linux-iio, linux-kernel, Hennerich, Michael

On 12/14/2012 08:47 AM, Axel Lin wrote:
> regulator_get_voltage() may return negative error code.
> Add error checking to avoid setting error code to st->vref_uv.
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Thanks Axel, for the whole series:
Acked-by: Lars-Peter Clausen <lars@metafoo.de>

> ---
>  drivers/iio/adc/ad7266.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
> index a6f4fc5..e36107d 100644
> --- a/drivers/iio/adc/ad7266.c
> +++ b/drivers/iio/adc/ad7266.c
> @@ -411,7 +411,11 @@ static int __devinit ad7266_probe(struct spi_device *spi)
>  		if (ret)
>  			goto error_put_reg;
>  
> -		st->vref_uv = regulator_get_voltage(st->reg);
> +		ret = regulator_get_voltage(st->reg);
> +		if (ret < 0)
> +			goto error_disable_reg;
> +
> +		st->vref_uv = ret;
>  	} else {
>  		/* Use internal reference */
>  		st->vref_uv = 2500000;


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

end of thread, other threads:[~2012-12-14  9:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14  7:47 [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Axel Lin
2012-12-14  7:48 ` [PATCH 2/6] iio: dac: ad5380: Don't set error code to st->vref Axel Lin
2012-12-14  7:51 ` [PATCH 3/6] iio: dac: ad5504: Don't set error code to voltage_uv Axel Lin
2012-12-14  7:52 ` [PATCH 4/6] iio: dac: ad5624r_spi: " Axel Lin
2012-12-14  7:54 ` [PATCH 5/6] iio: dac: ad5686: " Axel Lin
2012-12-14  7:55 ` [PATCH 6/6] iio: dac: ad5791: Don't set error code to [pos|neg]_voltage_uv Axel Lin
2012-12-14  9:56 ` [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv Lars-Peter Clausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).