power: supply: cpcap-battery: Fix platform_get_irq_byname's error checking

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>
This commit is contained in:
Arvind Yadav 2017-11-24 22:31:40 +05:30 committed by Sebastian Reichel
parent 09edcb6475
commit aac7990407
1 changed files with 2 additions and 2 deletions

View File

@ -586,8 +586,8 @@ static int cpcap_battery_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 irq;
error = devm_request_threaded_irq(ddata->dev, irq, NULL, error = devm_request_threaded_irq(ddata->dev, irq, NULL,
cpcap_battery_irq_thread, cpcap_battery_irq_thread,