]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
power: reset: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 20 Jan 2022 10:46:54 +0000 (10:46 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:57:31 +0000 (11:57 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ba18dad0fb880cd29aa97b6b75560ef14d1061ba ]

platform_get_irq() returns negative error number instead 0 on failure.
And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes: f7a388d6cd1c ("power: reset: Add a driver for the Gemini poweroff")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3a4bcc4cb612e0381707582aa8ea0be7194edc63)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/power/reset/gemini-poweroff.c

index 90e35c07240aee158c3478a4f6a248c15b138552..b7f7a8225f22e133726833e78b39636bec967607 100644 (file)
@@ -107,8 +107,8 @@ static int gemini_poweroff_probe(struct platform_device *pdev)
                return PTR_ERR(gpw->base);
 
        irq = platform_get_irq(pdev, 0);
-       if (!irq)
-               return -EINVAL;
+       if (irq < 0)
+               return irq;
 
        gpw->dev = dev;