[PATCH 3/3] drivers/misc: (aspeed-lpc-snoop): Fix platform_get_irq() error checking

Igor Kononenko i.kononenko at yadro.com
Mon Aug 22 01:54:11 AEST 2022


The `platform_get_irq` return negative code that is indicate an error.
So `!lpc_snoop->irq` leads to misscought a failure.
This patch brings fix of checking negative `rc`.

Signed-off-by: Igor Kononenko <i.kononenko at yadro.com>
---
 drivers/soc/aspeed/aspeed-lpc-snoop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/aspeed/aspeed-lpc-snoop.c b/drivers/soc/aspeed/aspeed-lpc-snoop.c
index 6ec47bf1dc6b..25731cf0342d 100644
--- a/drivers/soc/aspeed/aspeed-lpc-snoop.c
+++ b/drivers/soc/aspeed/aspeed-lpc-snoop.c
@@ -167,7 +167,7 @@ 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)
+	if (lpc_snoop->irq < 0)
 		return -ENODEV;
 
 	rc = devm_request_irq(dev, lpc_snoop->irq,
-- 
2.25.1



More information about the openbmc mailing list