From: Pan Bian Date: Sun, 12 Nov 2017 15:52:02 +0000 (+0800) Subject: power: supply: cpcap-charger: fix incorrect return value check X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~6542^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=838c8afa67f98014970c9f56107805e767ed87ad;p=mirror_ubuntu-focal-kernel.git 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 Signed-off-by: Sebastian Reichel --- 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,