1
0
Fork 0

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>
hifive-unleashed-5.1
Pan Bian 2017-11-12 23:52:02 +08:00 committed by Sebastian Reichel
parent 33a7067732
commit 838c8afa67
1 changed files with 1 additions and 1 deletions

View File

@ -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,