power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking
authorArvind Yadav <arvind.yadav.cs@gmail.com>
Fri, 24 Nov 2017 17:01:40 +0000 (22:31 +0530)
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>
Fri, 1 Dec 2017 15:22:10 +0000 (16:22 +0100)
The platform_get_irq_byname() function returns -1 if an error occurs.
zero or positive number on success. platform_get_irq_byname() error
checking for zero is not correct.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/power/supply/cpcap-battery.c

index ee71a2b37b12c6432ffe1ab3803bd1a1072b44b4..98ba07869c3b00afb16d8f4d71d4ece9f855c40d 100644 (file)
@@ -586,8 +586,8 @@ static int cpcap_battery_init_irq(struct platform_device *pdev,
        int irq, error;
 
        irq = platform_get_irq_byname(pdev, name);
-       if (!irq)
-               return -ENODEV;
+       if (irq < 0)
+               return irq;
 
        error = devm_request_threaded_irq(ddata->dev, irq, NULL,
                                          cpcap_battery_irq_thread,