Re: [PATCH 1/6] iio: adc: ad7266: Don't set error code to st->vref_uv

From: Lars-Peter Clausen
Date: Fri Dec 14 2012 - 04:56:52 EST


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@xxxxxxxxxx>

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

> ---
> 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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/