diff mbox series

iio: adc: ti-ads1100: fix error code in probe()

Message ID 36fa2aeb-f392-4793-8b38-ae15514033c8@kili.mountain (mailing list archive)
State Accepted
Headers show
Series iio: adc: ti-ads1100: fix error code in probe() | expand

Commit Message

Dan Carpenter March 23, 2023, 3:23 p.m. UTC
This code has a copy and paste bug so it accidentally returns
"PTR_ERR(data->reg_vdd)" which is a valid pointer cast to int. It
should return "ret" instead.

Fixes: 541880542f2b ("iio: adc: Add TI ADS1100 and ADS1000")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/iio/adc/ti-ads1100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron April 1, 2023, 1:37 p.m. UTC | #1
On Thu, 23 Mar 2023 18:23:56 +0300
Dan Carpenter <error27@gmail.com> wrote:

> This code has a copy and paste bug so it accidentally returns
> "PTR_ERR(data->reg_vdd)" which is a valid pointer cast to int. It
> should return "ret" instead.
> 
> Fixes: 541880542f2b ("iio: adc: Add TI ADS1100 and ADS1000")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Applied to the togreg branch of iio.git as this driver is not yet upstream.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ti-ads1100.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ti-ads1100.c b/drivers/iio/adc/ti-ads1100.c
> index 6a478efb108b..6b5aebb82455 100644
> --- a/drivers/iio/adc/ti-ads1100.c
> +++ b/drivers/iio/adc/ti-ads1100.c
> @@ -344,7 +344,7 @@ static int ads1100_probe(struct i2c_client *client)
>  
>  	ret = regulator_enable(data->reg_vdd);
>  	if (ret < 0)
> -		return dev_err_probe(dev, PTR_ERR(data->reg_vdd),
> +		return dev_err_probe(dev, ret,
>  				     "Failed to enable vdd regulator\n");
>  
>  	ret = devm_add_action_or_reset(dev, ads1100_reg_disable, data->reg_vdd);
diff mbox series

Patch

diff --git a/drivers/iio/adc/ti-ads1100.c b/drivers/iio/adc/ti-ads1100.c
index 6a478efb108b..6b5aebb82455 100644
--- a/drivers/iio/adc/ti-ads1100.c
+++ b/drivers/iio/adc/ti-ads1100.c
@@ -344,7 +344,7 @@  static int ads1100_probe(struct i2c_client *client)
 
 	ret = regulator_enable(data->reg_vdd);
 	if (ret < 0)
-		return dev_err_probe(dev, PTR_ERR(data->reg_vdd),
+		return dev_err_probe(dev, ret,
 				     "Failed to enable vdd regulator\n");
 
 	ret = devm_add_action_or_reset(dev, ads1100_reg_disable, data->reg_vdd);