public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors
@ 2024-07-22 14:18 Ma Ke
  2024-07-22 15:42 ` Markus Elfring
  2024-08-15 13:32 ` [PATCH v3] " Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Ma Ke @ 2024-07-22 14:18 UTC (permalink / raw)
  To: broonie, jwboyer, dbrownell, sfalco, akpm, sr
  Cc: linux-spi, linux-kernel, Ma Ke

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.

Fixes: 44dab88e7cc9 ("spi: add spi_ppc4xx driver")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
Changes in v3:
- removed Cc stable line as suggestions.
Changes in v2:
- added Cc stable line;
- added Fixes line.
---
 drivers/spi/spi-ppc4xx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 01fdecbf132d..599c29a31269 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -416,6 +416,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
 	if (hw->irqnum <= 0)
 		goto free_host;
 
+	if (hw->irqnum <= 0)
+		goto free_host;
+
 	ret = request_irq(hw->irqnum, spi_ppc4xx_int,
 			  0, "spi_ppc4xx_of", (void *)hw);
 	if (ret) {
-- 
2.25.1


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

end of thread, other threads:[~2024-08-18 22:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 14:18 [PATCH v3] spi: ppc4xx: handle irq_of_parse_and_map() errors Ma Ke
2024-07-22 15:42 ` Markus Elfring
2024-07-22 17:10   ` Mark Brown
2024-07-22 18:24     ` [v3] " Markus Elfring
2024-07-23  7:45     ` Markus Elfring
2024-08-15 13:32 ` [PATCH v3] " Mark Brown
2024-08-18 22:02   ` lee.lockhey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox