spi: microchip-core: fix potentially incorrect return from probe

If platform_get_irqi() returns 0, the error case will be triggered but
probe() will return 0 rather than an error. Ape the other drivers using
this pattern and return -ENXIO.

Reported-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/linux-spi/20220609055533.95866-2-yang.lee@linux.alibaba.com/
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Fixes: 9ac8d17694 ("spi: add support for microchip fpga spi controllers")
Link: https://lore.kernel.org/r/20220614065809.1969177-1-conor.dooley@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Conor Dooley 2022-06-14 07:58:10 +01:00 committed by Mark Brown
parent 35f2b9afc2
commit d38dc01a4e
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -541,7 +541,7 @@ static int mchp_corespi_probe(struct platform_device *pdev)
spi->irq = platform_get_irq(pdev, 0);
if (spi->irq <= 0) {
dev_err(&pdev->dev, "invalid IRQ %d for SPI controller\n", spi->irq);
ret = spi->irq;
ret = -ENXIO;
goto error_release_master;
}