power: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
PATCH 1/1 power: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
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 <[email protected]>
--- drivers/power/reset/gemini-poweroff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/reset/gemini-poweroff.c +2 -2
@@ -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;
Signature · 1 line
2.17.1
Quoted 11 lines · Miaoqian Lin
platform_get_irq()returns negative error number instead 0 on failure. And the doc ofplatform_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 <[email protected]>
Reviewed-by Linus Walleij <[email protected]>
Yours,
Linus Walleij