summaryrefslogtreecommitdiff
path: root/drivers/power/supply/cpcap-charger.c
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2017-11-12 18:52:02 +0300
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>2017-11-13 13:56:12 +0300
commit838c8afa67f98014970c9f56107805e767ed87ad (patch)
tree60faf31c3ca8e32304d500efbe2ba975a693746f /drivers/power/supply/cpcap-charger.c
parent33a7067732cf1b86b5dc672cfa9bbc15460117e5 (diff)
downloadlinux-838c8afa67f98014970c9f56107805e767ed87ad.tar.xz
power: supply: cpcap-charger: fix incorrect return value check
Function platform_get_irq_byname() returns a negative error code on failure, and a zero or positive number on success. However, in function cpcap_usb_init_irq(), positive IRQ numbers are also taken as error cases. Use "if (irq < 0)" instead of "if (!irq)" to validate the return value of platform_get_irq_byname(). Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power/supply/cpcap-charger.c')
-rw-r--r--drivers/power/supply/cpcap-charger.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
index 11a07633de6c..e4905bef2663 100644
--- a/drivers/power/supply/cpcap-charger.c
+++ b/drivers/power/supply/cpcap-charger.c
@@ -484,7 +484,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev,
int irq, error;
irq = platform_get_irq_byname(pdev, name);
- if (!irq)
+ if (irq < 0)
return -ENODEV;
error = devm_request_threaded_irq(ddata->dev, irq, NULL,