From: Ma Ke <make24@iscas.ac.cn>
To: broonie@kernel.org, jwboyer@linux.vnet.ibm.com, weo@reccoware.de,
sfalco@harris.com, sr@denx.de, dbrownell@users.sourceforge.net
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Ma Ke <make24@iscas.ac.cn>
Subject: [PATCH v4] spi: ppc4xx: handle irq_of_parse_and_map() errors
Date: Wed, 24 Jul 2024 16:40:47 +0800 [thread overview]
Message-ID: <20240724084047.1506084-1-make24@iscas.ac.cn> (raw)
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 v4:
- fixed a typo in v3. Sorry for the error in the patch v3.
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 942c3117ab3a..01fdecbf132d 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -413,6 +413,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)
/* Request IRQ */
hw->irqnum = irq_of_parse_and_map(np, 0);
+ 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
next reply other threads:[~2024-07-24 8:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 8:40 Ma Ke [this message]
2024-07-24 11:35 ` Markus Elfring
2024-07-24 11:39 ` Mark Brown
2024-07-24 11:55 ` [v4] " Markus Elfring
2024-07-29 15:40 ` [PATCH v4] " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240724084047.1506084-1-make24@iscas.ac.cn \
--to=make24@iscas.ac.cn \
--cc=broonie@kernel.org \
--cc=dbrownell@users.sourceforge.net \
--cc=jwboyer@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=sfalco@harris.com \
--cc=sr@denx.de \
--cc=weo@reccoware.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®