[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240830135943.3443245-1-make24@iscas.ac.cn>
Date: Fri, 30 Aug 2024 21:59:43 +0800
From: Ma Ke <make24@...as.ac.cn>
To: broonie@...nel.org,
grant.likely@...retlab.ca,
akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org,
Ma Ke <make24@...as.ac.cn>,
stable@...r.kernel.org
Subject: [PATCH] powerpc/5200: handle irq_of_parse_and_map() errors
Zero and negative number is not a valid IRQ for in-kernel code and the
irq_of_parse_and_map() function returns zero on error. So this check for
valid IRQs should only accept values > 0.
Cc: stable@...r.kernel.org
Fixes: 42bbb70980f3 ("powerpc/5200: Add mpc5200-spi (non-PSC) device driver")
Signed-off-by: Ma Ke <make24@...as.ac.cn>
---
drivers/spi/spi-mpc52xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c
index d5ac60c135c2..b49155a25694 100644
--- a/drivers/spi/spi-mpc52xx.c
+++ b/drivers/spi/spi-mpc52xx.c
@@ -472,7 +472,7 @@ static int mpc52xx_spi_probe(struct platform_device *op)
INIT_WORK(&ms->work, mpc52xx_spi_wq);
/* Decide if interrupts can be used */
- if (ms->irq0 && ms->irq1) {
+ if (ms->irq0 > 0 && ms->irq1 > 0) {
rc = request_irq(ms->irq0, mpc52xx_spi_irq, 0,
"mpc5200-spi-modf", ms);
rc |= request_irq(ms->irq1, mpc52xx_spi_irq, 0,
--
2.25.1
Powered by blists - more mailing lists