Skip to contentSkip to conversation

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

PATCH In review Conor Dooley 2 participants 3 messages Jun 14, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/spi/spi-microchip-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-microchip-core.c +1 -1
index 5b22a1395554..856a68fd8e9f 100644
@@ -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;
 	}
 
Signature · 1 line
2.36.1
#1 lore raw
Quoted 6 lines · Conor Dooley

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.

Woops, forgot this one:

Fixes 9ac8d17694b6 ("spi: add support for microchip fpga spi controllers")
Quoted 18 lines
---
  drivers/spi/spi-microchip-core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-microchip-core.c +1 -1
index 5b22a1395554..856a68fd8e9f 100644
@@ -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;
  	}
 
maintainer
#2 lore raw
In reply to Conor Dooley
Quoted 5 lines · Conor Dooley

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