Message ID | 20191022111856.44118-1-weiyongjun1@huawei.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | [-next] power: supply: ab8500_charger: Fix wrong pointer passed to PTR_ERR() | expand |
On Tue, Oct 22, 2019 at 1:19 PM Wei Yongjun <weiyongjun1@huawei.com> wrote: > PTR_ERR should access the value just tested by IS_ERR, otherwise > the wrong error code will be returned. > > Fixes: 97ab78bac5d0 ("power: supply: ab8500_charger: Convert to IIO ADC") > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> If Sebastian has pulled Jon's branch into his tree he can apply it in the power tree I suppose. Yours, Linus Walleij
Hi, On Tue, Oct 22, 2019 at 11:18:56AM +0000, Wei Yongjun wrote: > PTR_ERR should access the value just tested by IS_ERR, otherwise > the wrong error code will be returned. > > Fixes: 97ab78bac5d0 ("power: supply: ab8500_charger: Convert to IIO ADC") > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> > --- Thanks for the patch. Gustavo A. R. Silva send an identical patch one day earlier, so I applied his patch and added an Reviewed-by from you. -- 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)) { > > >
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)) {
PTR_ERR should access the value just tested by IS_ERR, otherwise the wrong error code will be returned. Fixes: 97ab78bac5d0 ("power: supply: ab8500_charger: Convert to IIO ADC") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> --- drivers/power/supply/ab8500_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)