Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: cadence-quadspi: Fix cqspi_probe() error handling for runtime pm

Commit f1eb4e792bb1 ("spi: spi-cadence-quadspi: Enable pm runtime earlier
to avoid imbalance") relocated code but missed updating the error handling
path associated with it.

Prior to the relocation, runtime pm was enabled after the code-block
associated with 'cqspi_request_mmap_dma()', due to which, the error
handling for the same didn't require invoking 'pm_runtime_disable()'.

Post refactoring, runtime pm has been enabled before the code-block and
when an error is encountered, jumping to 'probe_dma_failed' doesn't
invoke 'pm_runtime_disable()'. This leads to a race condition wherein
'cqspi_runtime_suspend()' is invoked while the error handling path executes
in parallel. The resulting error is the following:

clk:103:0 already disabled
WARNING: drivers/clk/clk.c:1188 at clk_core_disable+0x80/0xa0, CPU#1: kworker/u8:0/12
[TRIMMED]
pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : clk_core_disable+0x80/0xa0
lr : clk_core_disable+0x80/0xa0
[TRIMMED]
Call trace:
clk_core_disable+0x80/0xa0 (P)
clk_core_disable_lock+0x88/0x10c
clk_disable+0x24/0x30
cqspi_probe+0xa3c/0xae8
[TRIMMED]

The error is due to the second invocation of 'clk_disable_unprepare()' on
'cqspi->clk' in the error handling within 'cqspi_probe()', with the first
invocation being within 'cqspi_runtime_suspend()'.

Fix this by correcting the error handling.

Fixes: f1eb4e792bb1 ("spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance")
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Link: https://patch.msgid.link/20251119152545.2591651-1-s-vadapalli@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Siddharth Vadapalli and committed by
Mark Brown
295fe840 fd9862f7

+1 -2
+1 -2
drivers/spi/spi-cadence-quadspi.c
··· 2002 2002 if (cqspi->use_direct_mode) { 2003 2003 ret = cqspi_request_mmap_dma(cqspi); 2004 2004 if (ret == -EPROBE_DEFER) 2005 - goto probe_dma_failed; 2005 + goto probe_setup_failed; 2006 2006 } 2007 2007 2008 2008 ret = spi_register_controller(host); ··· 2020 2020 probe_setup_failed: 2021 2021 if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) 2022 2022 pm_runtime_disable(dev); 2023 - probe_dma_failed: 2024 2023 cqspi_controller_enable(cqspi, 0); 2025 2024 probe_reset_failed: 2026 2025 if (cqspi->is_jh7110)