mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
@ 2025-10-13 11:44 Mattijs Korpershoek
  2025-10-15 13:09 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Mattijs Korpershoek @ 2025-10-13 11:44 UTC (permalink / raw)
  To: Mark Brown, Khairul Anuar Romli, Dan Carpenter
  Cc: linux-spi, linux-kernel, Mattijs Korpershoek

In csqspi_probe(), when cqspi_request_mmap_dma() returns -EPROBE_DEFER,
we handle the error by jumping to probe_setup_failed.
In that label, we call pm_runtime_disable(), even if we never called
pm_runtime_enable() before.

Because of this, the driver cannot probe:

[    2.690018] cadence-qspi 47040000.spi: No Rx DMA available
[    2.699735] spi-nor spi0.0: resume failed with -13
[    2.699741] spi-nor: probe of spi0.0 failed with error -13

Only call pm_runtime_disable() if it was enabled by adding a new
label to handle spi_register_controller() failures.

Fixes: b07f349d1864 ("spi: spi-cadence-quadspi: Fix pm runtime unbalance")
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
---
This has been tested on a AM69 SK board.
---
Changes in v3:
- Rebased on spi/for-6.18 (Dropped Dan's review since rebase was
  non-trivial)
- Link to v2: https://lore.kernel.org/r/20251009-cadence-quadspi-fix-pm-runtime-v2-1-8bdfefc43902@kernel.org

Changes in v2:
- Updated message to use correct Fixes tag (Dan)
- Link to v1: https://lore.kernel.org/r/20251008-cadence-quadspi-fix-pm-runtime-v1-1-33bcb4b83a2e@kernel.org
---
 drivers/spi/spi-cadence-quadspi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 2ce4fc136a51ce3305e478c82da6b88ad542fc8c..4209578cb3426aad6707d0a46ddb78986c5eef7d 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -2002,15 +2002,17 @@ static int cqspi_probe(struct platform_device *pdev)
 	ret = spi_register_controller(host);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register SPI ctlr %d\n", ret);
-		goto probe_setup_failed;
+		goto probe_ctrl_failed;
 	}
 
 	pm_runtime_put_autosuspend(dev);
 
 	return 0;
+
+probe_ctrl_failed:
+	pm_runtime_disable(dev);
 probe_setup_failed:
 	cqspi_controller_enable(cqspi, 0);
-	pm_runtime_disable(dev);
 probe_reset_failed:
 	if (cqspi->is_jh7110)
 		cqspi_jh7110_disable_clk(pdev, cqspi);

---
base-commit: 18a5f1af596e6ba22cd40ada449063041f3ce6d4
change-id: 20251008-cadence-quadspi-fix-pm-runtime-bf8df9104577

Best regards,
-- 
Mattijs Korpershoek <mkorpershoek@kernel.org>


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

end of thread, other threads:[~2025-10-15 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-13 11:44 [PATCH v3] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER Mattijs Korpershoek
2025-10-15 13:09 ` Mark Brown

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

all inboxes | Powered by JetHome®