]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
pmdomain: core: Fix detach procedure for virtual devices in genpd
authorUlf Hansson <ulf.hansson@linaro.org>
Fri, 17 Apr 2026 11:13:31 +0000 (13:13 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 27 Apr 2026 12:36:17 +0000 (14:36 +0200)
commit26735dfdd8930d9ef1fa92e590a9bf77726efdf6
tree6d31264be9336fa0ef6a1a735c00ee17e02ccc10
parent254f49634ee16a731174d2ae34bc50bd5f45e731
pmdomain: core: Fix detach procedure for virtual devices in genpd

If a device is attached to a PM domain through genpd_dev_pm_attach_by_id(),
genpd calls pm_runtime_enable() for the corresponding virtual device that
it registers. While this avoids boilerplate code in drivers, there is no
corresponding call to pm_runtime_disable() in genpd_dev_pm_detach().

This means these virtual devices are typically detached from its genpd,
while runtime PM remains enabled for them, which is not how things are
designed to work. In worst cases it may lead to critical errors, like a
NULL pointer dereference bug in genpd_runtime_suspend(), which was recently
reported. For another case, we may end up keeping an unnecessary vote for a
performance state for the device.

To fix these problems, let's add this missing call to pm_runtime_disable()
in genpd_dev_pm_detach().

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/all/CAMuHMdWapT40hV3c+CSBqFOW05aWcV1a6v_NiJYgoYi0i9_PDQ@mail.gmail.com/
Fixes: 3c095f32a92b ("PM / Domains: Add support for multi PM domains per device to genpd")
Cc: stable@vger.kernel.org
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/core.c