]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spi: cadence-quadspi: Fix clock disable on probe failure path
authorAnurag Dutta <a-dutta@ti.com>
Fri, 12 Dec 2025 07:23:12 +0000 (12:53 +0530)
committerMark Brown <broonie@kernel.org>
Wed, 17 Dec 2025 12:01:10 +0000 (12:01 +0000)
When cqspi_request_mmap_dma() returns -EPROBE_DEFER after runtime PM
is enabled, the error path calls clk_disable_unprepare() on an already
disabled clock, causing an imbalance.

Use pm_runtime_get_sync() to increment the usage counter and resume the
device. This prevents runtime_suspend() from being invoked and causing
a double clock disable.

Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Anurag Dutta <a-dutta@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Link: https://patch.msgid.link/20251212072312.2711806-3-a-dutta@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-cadence-quadspi.c

index 7c1f742d95a6843d0b84d2a5949fe7e76d8dbae8..f8823e83a62263e07ef0a71567f58eff8ac02cbb 100644 (file)
@@ -2026,7 +2026,9 @@ probe_setup_failed:
 probe_reset_failed:
        if (cqspi->is_jh7110)
                cqspi_jh7110_disable_clk(pdev, cqspi);
-       clk_disable_unprepare(cqspi->clk);
+
+       if (pm_runtime_get_sync(&pdev->dev) >= 0)
+               clk_disable_unprepare(cqspi->clk);
 probe_clk_failed:
        return ret;
 }