power: supply: 88pm860x_battery: fix the return value handle for platform_get_irq()
authorRuan Jinjie <ruanjinjie@huawei.com>
Mon, 31 Jul 2023 11:39:59 +0000 (19:39 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 12 Sep 2023 18:44:52 +0000 (20:44 +0200)
There is no possible for platform_get_irq() to return 0,
and the return value of platform_get_irq() is more sensible
to show the error reason.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230731113959.1957820-1-ruanjinjie@huawei.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/88pm860x_battery.c

index f3f3f8cd1a7f87e2f654a7bf3c8633b6659dc72b..34619c4d4eced966e04ef03faa0a518d98ddb081 100644 (file)
@@ -921,12 +921,12 @@ static int pm860x_battery_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        info->irq_cc = platform_get_irq(pdev, 0);
-       if (info->irq_cc <= 0)
-               return -EINVAL;
+       if (info->irq_cc < 0)
+               return info->irq_cc;
 
        info->irq_batt = platform_get_irq(pdev, 1);
-       if (info->irq_batt <= 0)
-               return -EINVAL;
+       if (info->irq_batt < 0)
+               return info->irq_batt;
 
        info->chip = chip;
        info->i2c =