Skip to content

Commit

Permalink
spi: meson-spicc: add IRQ check in meson_spicc_probe
Browse files Browse the repository at this point in the history
This check misses checking for  platform_get_irq()'s call and may passes
the negative error codes to devm_request_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.
Stop calling devm_request_irq() with invalid IRQ #s.

Fixes: 454fa27 ("spi: Add Meson SPICC driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220126110447.24549-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Miaoqian Lin authored and Mark Brown committed Jan 26, 2022
1 parent 23e3404 commit e937440
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/spi/spi-meson-spicc.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev)
writel_relaxed(0, spicc->base + SPICC_INTREG);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
ret = irq;
goto out_master;
}

ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,
0, NULL, spicc);
if (ret) {
Expand Down

0 comments on commit e937440

Please sign in to comment.