Skip to contentSkip to conversation

spi: mtk-nor: Propagate errors from optional IRQ lookup

PATCH In review [email protected] 2 participants 3 messages Aug 7 – Aug 13

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

PATCH 1/2 spi: mtk-nor: Propagate errors from optional IRQ lookup

From: bui duc phuc <[email protected]>

platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no IRQ is available, while other errors should be propagated.

Propagate errors such as -EPROBE_DEFER and -EINVAL instead of continuing probe without the IRQ.

---
 drivers/spi/spi-mtk-nor.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/spi/spi-mtk-nor.c +5 -0
index 74f34537b02c..6b9a5d728549 100644
@@ -895,6 +895,10 @@ static int mtk_nor_probe(struct platform_device *pdev)
 	irq = platform_get_irq_optional(pdev, 0);
 
 	if (irq < 0) {
+		if (irq != -ENXIO) {
+			ret = irq;
+			goto err_disable_clk;
+		}
 		dev_warn(sp->dev, "IRQ not available.");
 	} else {
 		ret = devm_request_irq(sp->dev, irq, mtk_nor_irq_handler, 0,
@@ -928,6 +932,7 @@ static int mtk_nor_probe(struct platform_device *pdev)
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 
+err_disable_clk:
 	mtk_nor_disable_clk(sp);
 
 	return ret;
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 spi: mtk-nor: Propagate errors from IRQ request

From: bui duc phuc <[email protected]>

Treat a failure from devm_request_irq() as a probe error instead of continuing without an IRQ after only reporting a warning.

Return the error through the existing error path to ensure the driver does not continue with an unsuccessfully requested IRQ.

---
 drivers/spi/spi-mtk-nor.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-mtk-nor.c +1 -0
index 6b9a5d728549..c1e15246120f 100644
@@ -905,6 +905,7 @@ static int mtk_nor_probe(struct platform_device *pdev)
 				       pdev->name, sp);
 		if (ret < 0) {
 			dev_warn(sp->dev, "failed to request IRQ.");
+			goto err_disable_clk;
 		} else {
 			init_completion(&sp->op_done);
 			sp->has_irq = true;
Signature · 1 line
2.43.0
maintainer
#2 lore raw
In reply to [email protected]
Quoted 1 line · On Fri, 07 Aug 2026 17:29:30 +0700, [email protected] wrote:

spi: mtk-nor: Propagate errors from optional IRQ lookup

Applied to

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

Thanks!

[1/2] spi: mtk-nor: Propagate errors from optional IRQ lookup

      https://git.kernel.org/broonie/spi/c/356d5869bc33
[2/2] spi: mtk-nor: Propagate errors from IRQ request
      https://git.kernel.org/broonie/spi/c/560fbcf4720b

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