]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spi: meson-spifc: fix runtime PM leak on remove
authorRuoyu Wang <ruoyuw560@gmail.com>
Tue, 9 Jun 2026 05:26:47 +0000 (13:26 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 9 Jun 2026 23:06:47 +0000 (00:06 +0100)
pm_runtime_get_sync() increments the runtime PM usage counter even when it
returns an error. meson_spifc_remove() uses it to resume the controller
before disabling runtime PM, but never drops the usage counter again.

Balance the get with pm_runtime_put_noidle() after disabling runtime PM,
matching the teardown pattern used by other SPI controller drivers.

Found by static analysis. I do not have hardware to test this.

Fixes: c3e4bc5434d2 ("spi: meson: Add support for Amlogic Meson SPIFC")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Link: https://patch.msgid.link/20260609052647.5-1-ruoyuw560@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-meson-spifc.c

index d700fa3152231afecdd255091a6a49540230f786..e36aa94bbdae3b8d1b6292876fcb7c8ee1da5590 100644 (file)
@@ -345,6 +345,7 @@ static void meson_spifc_remove(struct platform_device *pdev)
 {
        pm_runtime_get_sync(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
+       pm_runtime_put_noidle(&pdev->dev);
 }
 
 #ifdef CONFIG_PM_SLEEP