diff options
author | Ma Ke <make24@iscas.ac.cn> | 2024-07-22 22:18:22 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-08-14 18:26:49 +0100 |
commit | f1011ba20b83da3ee70dcb4a6d9d282a718916fa (patch) | |
tree | 554d68cd5fac9e6f2c9e53dd693bee4658f2fa01 /drivers/spi/spi-ppc4xx.c | |
parent | 1c4d834e4e81637995b079fdb64fad4c32af15c8 (diff) |
spi: ppc4xx: 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.
Fixes: 44dab88e7cc9 ("spi: add spi_ppc4xx driver")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Link: https://patch.msgid.link/20240722141822.1052370-1-make24@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-ppc4xx.c')
-rw-r--r-- | drivers/spi/spi-ppc4xx.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) { |