Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: mtk-nor: Propagate errors from optional IRQ lookup
@ 2026-08-07 10:29 phucduc.bui
  2026-08-07 10:29 ` [PATCH 2/2] spi: mtk-nor: Propagate errors from IRQ request phucduc.bui
  0 siblings, 1 reply; 2+ messages in thread
From: phucduc.bui @ 2026-08-07 10:29 UTC (permalink / raw)
  To: Mark Brown, Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-spi, linux-kernel, linux-arm-kernel, linux-mediatek,
	bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/spi/spi-mtk-nor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c
index 74f34537b02c..6b9a5d728549 100644
--- a/drivers/spi/spi-mtk-nor.c
+++ b/drivers/spi/spi-mtk-nor.c
@@ -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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] spi: mtk-nor: Propagate errors from IRQ request
  2026-08-07 10:29 [PATCH 1/2] spi: mtk-nor: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-07 10:29 ` phucduc.bui
  0 siblings, 0 replies; 2+ messages in thread
From: phucduc.bui @ 2026-08-07 10:29 UTC (permalink / raw)
  To: Mark Brown, Matthias Brugger, AngeloGioacchino Del Regno
  Cc: linux-spi, linux-kernel, linux-arm-kernel, linux-mediatek,
	bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/spi/spi-mtk-nor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c
index 6b9a5d728549..c1e15246120f 100644
--- a/drivers/spi/spi-mtk-nor.c
+++ b/drivers/spi/spi-mtk-nor.c
@@ -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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-07 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 10:29 [PATCH 1/2] spi: mtk-nor: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-07 10:29 ` [PATCH 2/2] spi: mtk-nor: Propagate errors from IRQ request phucduc.bui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox