diff mbox series

power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR

Message ID 20191021174937.GA17424@embeddedor (mailing list archive)
State Not Applicable, archived
Headers show
Series power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR | expand

Commit Message

Gustavo A. R. Silva Oct. 21, 2019, 5:49 p.m. UTC
Fix inconsistent IS_ERR and PTR_ERR in ab8500_charger_probe().

The proper pointer to be passed as argument is di->adc_main_charger_c

This bug was detected with the help of Coccinelle.

Fixes: 97ab78bac5d0 ("power: supply: ab8500_charger: Convert to IIO ADC")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/power/supply/ab8500_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sebastian Reichel Oct. 27, 2019, 9:30 p.m. UTC | #1
Hi,

On Mon, Oct 21, 2019 at 12:49:37PM -0500, Gustavo A. R. Silva wrote:
> Fix inconsistent IS_ERR and PTR_ERR in ab8500_charger_probe().
> 
> The proper pointer to be passed as argument is di->adc_main_charger_c
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: 97ab78bac5d0 ("power: supply: ab8500_charger: Convert to IIO ADC")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/ab8500_charger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c
> index ff2bb4411a22..8a0f9d769690 100644
> --- a/drivers/power/supply/ab8500_charger.c
> +++ b/drivers/power/supply/ab8500_charger.c
> @@ -3393,7 +3393,7 @@ static int ab8500_charger_probe(struct platform_device *pdev)
>  		if (PTR_ERR(di->adc_main_charger_c) == -ENODEV)
>  			return -EPROBE_DEFER;
>  		dev_err(&pdev->dev, "failed to get ADC main charger current\n");
> -		return PTR_ERR(di->adc_main_charger_v);
> +		return PTR_ERR(di->adc_main_charger_c);
>  	}
>  	di->adc_vbus_v = devm_iio_channel_get(&pdev->dev, "vbus_v");
>  	if (IS_ERR(di->adc_vbus_v)) {
> -- 
> 2.23.0
>
Gustavo A. R. Silva Oct. 28, 2019, 8:37 p.m. UTC | #2
Hey Sebastian,

On 10/27/19 16:30, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Oct 21, 2019 at 12:49:37PM -0500, Gustavo A. R. Silva wrote:
>> Fix inconsistent IS_ERR and PTR_ERR in ab8500_charger_probe().
>>
>> The proper pointer to be passed as argument is di->adc_main_charger_c
>>
>> This bug was detected with the help of Coccinelle.
>>
>> Fixes: 97ab78bac5d0 ("power: supply: ab8500_charger: Convert to IIO ADC")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
> 
> Thanks, queued.
> 

Awesome.
Thank you!

--
Gustavo
diff mbox series

Patch

diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c
index ff2bb4411a22..8a0f9d769690 100644
--- a/drivers/power/supply/ab8500_charger.c
+++ b/drivers/power/supply/ab8500_charger.c
@@ -3393,7 +3393,7 @@  static int ab8500_charger_probe(struct platform_device *pdev)
 		if (PTR_ERR(di->adc_main_charger_c) == -ENODEV)
 			return -EPROBE_DEFER;
 		dev_err(&pdev->dev, "failed to get ADC main charger current\n");
-		return PTR_ERR(di->adc_main_charger_v);
+		return PTR_ERR(di->adc_main_charger_c);
 	}
 	di->adc_vbus_v = devm_iio_channel_get(&pdev->dev, "vbus_v");
 	if (IS_ERR(di->adc_vbus_v)) {