diff mbox series

[1/3] iio: adc: ad799x: fix probe error handling

Message ID 20190917160925.9791-2-m.felsch@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series ADC AD799x improvements | expand

Commit Message

Marco Felsch Sept. 17, 2019, 4:09 p.m. UTC
Since commit 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe
and reset alert status on probe") the error path is wrong since it
leaves the vref regulator on. Fix this by disabling both regulators.

Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and
reset alert status on probe")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/iio/adc/ad799x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexandru Ardelean Sept. 18, 2019, 6:29 a.m. UTC | #1
On Tue, 2019-09-17 at 18:09 +0200, Marco Felsch wrote:
> [External]
> 
> Since commit 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe
> and reset alert status on probe") the error path is wrong since it
> leaves the vref regulator on. Fix this by disabling both regulators.
> 

Good catch.
Many thanks :)

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

> Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and
> reset alert status on probe")
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/iio/adc/ad799x.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
> index 5a3ca5904ded..f658012baad8 100644
> --- a/drivers/iio/adc/ad799x.c
> +++ b/drivers/iio/adc/ad799x.c
> @@ -810,10 +810,10 @@ static int ad799x_probe(struct i2c_client *client,
>  
>  	ret = ad799x_write_config(st, st->chip_config->default_config);
>  	if (ret < 0)
> -		goto error_disable_reg;
> +		goto error_disable_vref;
>  	ret = ad799x_read_config(st);
>  	if (ret < 0)
> -		goto error_disable_reg;
> +		goto error_disable_vref;
>  	st->config = ret;
>  
>  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
Jonathan Cameron Oct. 5, 2019, 12:38 p.m. UTC | #2
On Wed, 18 Sep 2019 06:29:19 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Tue, 2019-09-17 at 18:09 +0200, Marco Felsch wrote:
> > [External]
> > 
> > Since commit 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe
> > and reset alert status on probe") the error path is wrong since it
> > leaves the vref regulator on. Fix this by disabling both regulators.
> >   
> 
> Good catch.
> Many thanks :)
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.

Obviously this may delay the other two patches which will get queued
up for the next merge window, but as we have plenty of time that shouldn't
be an issue.

Thanks,

Jonathan

> 
> > Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and
> > reset alert status on probe")
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> >  drivers/iio/adc/ad799x.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
> > index 5a3ca5904ded..f658012baad8 100644
> > --- a/drivers/iio/adc/ad799x.c
> > +++ b/drivers/iio/adc/ad799x.c
> > @@ -810,10 +810,10 @@ static int ad799x_probe(struct i2c_client *client,
> >  
> >  	ret = ad799x_write_config(st, st->chip_config->default_config);
> >  	if (ret < 0)
> > -		goto error_disable_reg;
> > +		goto error_disable_vref;
> >  	ret = ad799x_read_config(st);
> >  	if (ret < 0)
> > -		goto error_disable_reg;
> > +		goto error_disable_vref;
> >  	st->config = ret;
> >  
> >  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index 5a3ca5904ded..f658012baad8 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -810,10 +810,10 @@  static int ad799x_probe(struct i2c_client *client,
 
 	ret = ad799x_write_config(st, st->chip_config->default_config);
 	if (ret < 0)
-		goto error_disable_reg;
+		goto error_disable_vref;
 	ret = ad799x_read_config(st);
 	if (ret < 0)
-		goto error_disable_reg;
+		goto error_disable_vref;
 	st->config = ret;
 
 	ret = iio_triggered_buffer_setup(indio_dev, NULL,