Commit 838c8afa authored by Pan Bian's avatar Pan Bian Committed by Sebastian Reichel

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: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
parent 33a70677
...@@ -484,7 +484,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev, ...@@ -484,7 +484,7 @@ static int cpcap_usb_init_irq(struct platform_device *pdev,
int irq, error; int irq, error;
irq = platform_get_irq_byname(pdev, name); irq = platform_get_irq_byname(pdev, name);
if (!irq) if (irq < 0)
return -ENODEV; return -ENODEV;
error = devm_request_threaded_irq(ddata->dev, irq, NULL, error = devm_request_threaded_irq(ddata->dev, irq, NULL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment