diff mbox series

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

Message ID 20220614065809.1969177-1-conor.dooley@microchip.com
State Accepted
Commit d38dc01a4e68133e11ae74af7585d2c4bbd5803d
Headers show
Series spi: microchip-core: fix potentially incorrect return from probe | expand

Commit Message

Conor Dooley June 14, 2022, 6:58 a.m. UTC
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>
---
 drivers/spi/spi-microchip-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Conor Dooley June 14, 2022, 7:34 a.m. UTC | #1
On 14/06/2022 07:58, Conor Dooley wrote:
> 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/

Woops, forgot this one:
Fixes: 9ac8d17694b6 ("spi: add support for microchip fpga spi controllers")

> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>   drivers/spi/spi-microchip-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c
> index 5b22a1395554..856a68fd8e9f 100644
> --- a/drivers/spi/spi-microchip-core.c
> +++ b/drivers/spi/spi-microchip-core.c
> @@ -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;
>   	}
>
Mark Brown June 14, 2022, 11:51 a.m. UTC | #2
On Tue, 14 Jun 2022 07:58:10 +0100, Conor Dooley wrote:
> 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: microchip-core: fix potentially incorrect return from probe
      commit: d38dc01a4e68133e11ae74af7585d2c4bbd5803d

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-microchip-core.c b/drivers/spi/spi-microchip-core.c
index 5b22a1395554..856a68fd8e9f 100644
--- a/drivers/spi/spi-microchip-core.c
+++ b/drivers/spi/spi-microchip-core.c
@@ -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;
 	}