diff mbox

[1/3] iio: adc: twl4030: Fix an error handling path in 'twl4030_madc_probe()'

Message ID 4bcd315895de7135369e6e0d2402fc2794f2ee99.1506146101.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Christophe JAILLET Sept. 23, 2017, 6:06 a.m. UTC
If 'devm_regulator_get()' fails, we should go through the existing error
handling path instead of returning directly, as done is all the other
error handling paths in this function.

Fixes: 7cc97d77ee8a ("iio: adc: twl4030: Fix ADC[3:6] readings")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/iio/adc/twl4030-madc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron Sept. 24, 2017, 11:58 a.m. UTC | #1
On Sat, 23 Sep 2017 08:06:18 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> If 'devm_regulator_get()' fails, we should go through the existing error
> handling path instead of returning directly, as done is all the other
> error handling paths in this function.
> 
> Fixes: 7cc97d77ee8a ("iio: adc: twl4030: Fix ADC[3:6] readings")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied to the fixes-togreg-post-rc1 branch of iio.git and marked
for stable. 

Thanks,

Jonathan
> ---
>  drivers/iio/adc/twl4030-madc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index 1edd99f0c5e5..80ab2ed70b85 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -887,8 +887,10 @@ static int twl4030_madc_probe(struct platform_device *pdev)
>  
>  	/* Enable 3v1 bias regulator for MADC[3:6] */
>  	madc->usb3v1 = devm_regulator_get(madc->dev, "vusb3v1");
> -	if (IS_ERR(madc->usb3v1))
> -		return -ENODEV;
> +	if (IS_ERR(madc->usb3v1)) {
> +		ret = -ENODEV;
> +		goto err_i2c;
> +	}
>  
>  	ret = regulator_enable(madc->usb3v1);
>  	if (ret)

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 1edd99f0c5e5..80ab2ed70b85 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -887,8 +887,10 @@  static int twl4030_madc_probe(struct platform_device *pdev)
 
 	/* Enable 3v1 bias regulator for MADC[3:6] */
 	madc->usb3v1 = devm_regulator_get(madc->dev, "vusb3v1");
-	if (IS_ERR(madc->usb3v1))
-		return -ENODEV;
+	if (IS_ERR(madc->usb3v1)) {
+		ret = -ENODEV;
+		goto err_i2c;
+	}
 
 	ret = regulator_enable(madc->usb3v1);
 	if (ret)