Skip to contentSkip to conversation

spi: cadence-quadspi: fix unclocked access on unbind

PATCH In review Robert Garcia 2 participants 2 messages Jun 10 – Jun 11

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

PATCH 1/1 spi: cadence-quadspi: fix unclocked access on unbind

From: Johan Hovold <[email protected]>

[ Upstream commit 233db2cb14db8b1935dda52a6affd97276462b82 ]

Make sure that the controller is runtime resumed before disabling it during driver unbind to avoid an unclocked register access.

This issue was flagged by Sashiko when reviewing a controller deregistration fix.

Fixes 0578a6dbfe75 ("spi: spi-cadence-quadspi: add runtime pm support")
Cc Dhruva Gole <[email protected]>
[ Context adaptation performed. ]
---
 drivers/spi/spi-cadence-quadspi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-cadence-quadspi.c +3 -2
index 72262b6fb62b..da8401261bbc 100644
@@ -2013,13 +2013,14 @@ static void cqspi_remove(struct platform_device *pdev)
 		cqspi_wait_idle(cqspi);
 
 	spi_unregister_controller(cqspi->host);
-	cqspi_controller_enable(cqspi, 0);
 
 	if (cqspi->rx_chan)
 		dma_release_channel(cqspi->rx_chan);
 
-	if (pm_runtime_get_sync(&pdev->dev) >= 0)
+	if (pm_runtime_get_sync(&pdev->dev) >= 0) {
+		cqspi_controller_enable(cqspi, 0);
 		clk_disable(cqspi->clk);
+	}
 
 	if (cqspi->is_jh7110)
 		cqspi_jh7110_disable_clk(pdev, cqspi);
Signature · 1 line
2.44.3
maintainer
#1 lore raw
Quoted 1 line · Robert Garcia

[PATCH 6.12.y] spi: cadence-quadspi: fix unclocked access on unbind

I can't take this into 6.12 on its own. We don't backport a fix to an older tree while it's missing from a newer one, and 233db2cb14db isn't in 6.18.y yet.

If you can send a 6.18.y backport as well (adapted to the older cqspi_remove() there), I'll queue both together; the 6.12 patch itself looks fine.

--
Thanks,
Sasha