All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: aspeed: Fix IRQ check in aspeed_lpc_snoop_config_irq
@ 2022-01-14  6:43 ` Miaoqian Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Miaoqian Lin @ 2022-01-14  6:43 UTC (permalink / raw)
  To: Joel Stanley, Andrew Jeffery, Chia-Wei, Wang, Jae Hyun Yoo,
	Vernon Mauery, Miaoqian Lin, Dan Carpenter, Patrick Venture,
	Olof Johansson, Arnd Bergmann, linux-arm-kernel, linux-aspeed,
	linux-kernel

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: 524feb799408 ("soc: add aspeed folder and misc drivers")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/aspeed/aspeed-lpc-snoop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
index eceeaf8dfbeb..c4a03b3a5cf8 100644
--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
+++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
@@ -167,8 +167,8 @@ static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop,
 	int rc;
 
 	lpc_snoop->irq = platform_get_irq(pdev, 0);
-	if (!lpc_snoop->irq)
-		return -ENODEV;
+	if (lpc_snoop->irq < 0)
+		return lpc_snoop->irq;
 
 	rc = devm_request_irq(dev, lpc_snoop->irq,
 			      aspeed_lpc_snoop_irq, IRQF_SHARED,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] soc: aspeed: Fix IRQ check in aspeed_lpc_snoop_config_irq
@ 2022-01-14  6:43 ` Miaoqian Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Miaoqian Lin @ 2022-01-14  6:43 UTC (permalink / raw)
  To: Joel Stanley, Andrew Jeffery, Chia-Wei, Wang, Jae Hyun Yoo,
	Vernon Mauery, Miaoqian Lin, Dan Carpenter, Patrick Venture,
	Olof Johansson, Arnd Bergmann, linux-arm-kernel, linux-aspeed,
	linux-kernel

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: 524feb799408 ("soc: add aspeed folder and misc drivers")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/aspeed/aspeed-lpc-snoop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
index eceeaf8dfbeb..c4a03b3a5cf8 100644
--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
+++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
@@ -167,8 +167,8 @@ static int aspeed_lpc_snoop_config_irq(struct aspeed_lpc_snoop *lpc_snoop,
 	int rc;
 
 	lpc_snoop->irq = platform_get_irq(pdev, 0);
-	if (!lpc_snoop->irq)
-		return -ENODEV;
+	if (lpc_snoop->irq < 0)
+		return lpc_snoop->irq;
 
 	rc = devm_request_irq(dev, lpc_snoop->irq,
 			      aspeed_lpc_snoop_irq, IRQF_SHARED,
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] soc: aspeed: Fix IRQ check in aspeed_lpc_snoop_config_irq
  2022-01-14  6:43 ` Miaoqian Lin
@ 2022-01-17  0:05   ` ChiaWei Wang
  -1 siblings, 0 replies; 4+ messages in thread
From: ChiaWei Wang @ 2022-01-17  0:05 UTC (permalink / raw)
  To: Miaoqian Lin, Joel Stanley, Andrew Jeffery, Jae Hyun Yoo,
	Vernon Mauery, Dan Carpenter, Patrick Venture, Olof Johansson,
	Arnd Bergmann, linux-arm-kernel, linux-aspeed, linux-kernel

> From: Miaoqian Lin <linmq006@gmail.com>
> Sent: Friday, January 14, 2022 2:44 PM
> 
> 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: 524feb799408 ("soc: add aspeed folder and misc drivers")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] soc: aspeed: Fix IRQ check in aspeed_lpc_snoop_config_irq
@ 2022-01-17  0:05   ` ChiaWei Wang
  0 siblings, 0 replies; 4+ messages in thread
From: ChiaWei Wang @ 2022-01-17  0:05 UTC (permalink / raw)
  To: Miaoqian Lin, Joel Stanley, Andrew Jeffery, Jae Hyun Yoo,
	Vernon Mauery, Dan Carpenter, Patrick Venture, Olof Johansson,
	Arnd Bergmann, linux-arm-kernel, linux-aspeed, linux-kernel

> From: Miaoqian Lin <linmq006@gmail.com>
> Sent: Friday, January 14, 2022 2:44 PM
> 
> 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: 524feb799408 ("soc: add aspeed folder and misc drivers")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>

Thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-17  0:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14  6:43 [PATCH] soc: aspeed: Fix IRQ check in aspeed_lpc_snoop_config_irq Miaoqian Lin
2022-01-14  6:43 ` Miaoqian Lin
2022-01-17  0:05 ` ChiaWei Wang
2022-01-17  0:05   ` ChiaWei Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.