[PATCH] spi: rockchip: Fix runtime PM underflow on CS error paths

Mark Brown broonie at kernel.org
Fri Nov 6 06:58:38 PST 2026


> The Rockchip SPI driver manages runtime PM reference counting around
> chip select (CS) assertion: pm_runtime_get_sync() is called when CS is
> asserted, and pm_runtime_put() when deasserted. This balanced pair is
> expected.

> @@ -256,6 +257,7 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)
>  	if (cs_asserted) {
>  		/* Keep things powered as long as CS is asserted */
>  		pm_runtime_get_sync(rs->dev);
> +		rs->cs_claimed = true;

This sort of boolean tracking of reference counts is extremely error
prone, and note that there are two chip selects on the device.  This
should probably at least be per chip select.

-- 
Mark Brown <broonie at kernel.org>



More information about the Linux-rockchip mailing list