All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR
@ 2019-10-21 17:49 Gustavo A. R. Silva
  2019-10-27 21:30 ` Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-10-21 17:49 UTC (permalink / raw)
  To: Sebastian Reichel, Jonathan Cameron, Linus Walleij
  Cc: linux-pm, linux-kernel, Gustavo A. R. Silva

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(-)

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR
  2019-10-21 17:49 [PATCH] power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR Gustavo A. R. Silva
@ 2019-10-27 21:30 ` Sebastian Reichel
  2019-10-28 20:37   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Reichel @ 2019-10-27 21:30 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Jonathan Cameron, Linus Walleij, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR
  2019-10-27 21:30 ` Sebastian Reichel
@ 2019-10-28 20:37   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-10-28 20:37 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: Jonathan Cameron, Linus Walleij, linux-pm, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-28 20:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 17:49 [PATCH] power: supply: ab8500_charger: Fix inconsistent IS_ERR and PTR_ERR Gustavo A. R. Silva
2019-10-27 21:30 ` Sebastian Reichel
2019-10-28 20:37   ` Gustavo A. R. Silva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.