Re: [PATCH 6.12.y 1/2] spi: cadence-quadspi: fix runtime pm cleanup on probe failure/unbind

Sasha Levin <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-kernel,org.kernel.vger.linux-spi
Message-ID <[email protected]>
On Fri, Aug 07, 2026 at 01:49:20PM +0200, Diogo Ivo (Schneider Electric) wrote:
> +disable_rpm:
> +	pm_runtime_put_noidle(dev);
> +	pm_runtime_dont_use_autosuspend(dev);
> +	pm_runtime_disable(dev);
>  probe_setup_failed:
>  	cqspi_controller_enable(cqspi, 0);
> -	pm_runtime_disable(dev);

This teardown order is inverted relative to upstream, and it reinstates
a bug upstream deliberately closed.

pm_runtime_dont_use_autosuspend() runs update_autosuspend(), and with
the usage count already dropped to 0 by the preceding put_noidle() and
the device still RPM_ACTIVE, that can queue a runtime suspend, i.e.
cqspi_runtime_suspend() -> clk_disable_unprepare(). The following
pm_runtime_disable() does barrier it, but control then falls through to
probe_setup_failed, which does cqspi_controller_enable(cqspi, 0) - a
register write against a potentially gated clock. That is exactly the
unclocked access 233db2cb14db ("spi: cadence-quadspi: fix unclocked
access on unbind") went out of its way to prevent.

Please mirror the upstream ordering from 5e8bb0cc72f1 ("spi:
cadence-quadspi: fix runtime pm and clock imbalance on unbind"):

	pm_runtime_disable(dev);
	pm_runtime_set_suspended(dev);
	pm_runtime_put_noidle(dev);
	pm_runtime_dont_use_autosuspend(dev);

pm_runtime_set_suspended() is missing here as well.

>  	pm_runtime_put_sync(&pdev->dev);
> +	pm_runtime_dont_use_autosuspend(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);

Same ordering problem in cqspi_remove()...

> As the history of this driver in mainline is convoluted with several
> rounds of fixes it includes the fixes from two commits, namely
> commit 5ff4d5d1af0c ("spi: cadence-quadspi: fix runtime pm disable
> imbalance on probe failure") and commit 5e8bb0cc72f1 ("spi:
> cadence-quadspi: fix runtime pm and clock imbalance on unbind").

Please split this so each patch maps to exactly one upstream commit.

> Fixes: 74b0b4cf13fc ("spi: spi-cadence-quadspi: Fix pm runtime unbalance")
> Cc: [email protected]

Both Fixes: tags in this series point at stable-tree commits rather than
mainline ones.

-- 
Thanks,
Sasha
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.