* [PATCH] power: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
@ 2022-01-20 10:46 Miaoqian Lin
2022-01-23 1:01 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-01-20 10:46 UTC (permalink / raw)
To: Sebastian Reichel, Linus Walleij, linux-pm, linux-kernel; +Cc: linmq006
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>
---
drivers/power/reset/gemini-poweroff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/power/reset/gemini-poweroff.c b/drivers/power/reset/gemini-poweroff.c
index 90e35c07240a..b7f7a8225f22 100644
--- a/drivers/power/reset/gemini-poweroff.c
+++ b/drivers/power/reset/gemini-poweroff.c
@@ -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;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
2022-01-20 10:46 [PATCH] power: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe Miaoqian Lin
@ 2022-01-23 1:01 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2022-01-23 1:01 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: Sebastian Reichel, linux-pm, linux-kernel
On Thu, Jan 20, 2022 at 11:47 AM Miaoqian Lin <linmq006@gmail.com> wrote:
> 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>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-23 1:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-20 10:46 [PATCH] power: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe Miaoqian Lin
2022-01-23 1:01 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).