[PATCH] gpu: ipu-v3: prg: fix clock cleanup on remove
From: Guangshuo Li
Date: Sun Sep 13 2026 - 09:14:40 EST
ipu_prg_probe() enables the IPG and AXI clocks before enabling runtime
PM. The clocks are subsequently controlled by the runtime suspend and
resume callbacks.
However, ipu_prg_remove() only removes the PRG from the global list and
does not disable runtime PM or shut down the clocks when the device is
still runtime active. As a result, removing the driver while the device
is active leaves both clocks enabled.
Disable runtime PM during removal so that pending runtime PM operations
are completed and no new runtime PM callbacks can change the device
state. If the device is still runtime active afterwards, disable the
AXI and IPG clocks explicitly.
Check the runtime PM state before disabling the clocks because the
runtime suspend callback may already have disabled them. This avoids
unbalancing the clock enable counts when removing an already suspended
device.
This issue was found by manual code inspection.
Fixes: ea9c260514c1 ("gpu: ipu-v3: add driver for Prefetch Resolve Gasket")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
---
drivers/gpu/ipu-v3/ipu-prg.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c
index d38d3ba54d72..93033e847d0e 100644
--- a/drivers/gpu/ipu-v3/ipu-prg.c
+++ b/drivers/gpu/ipu-v3/ipu-prg.c
@@ -426,6 +426,13 @@ static void ipu_prg_remove(struct platform_device *pdev)
mutex_lock(&ipu_prg_list_mutex);
list_del(&prg->list);
mutex_unlock(&ipu_prg_list_mutex);
+
+ pm_runtime_disable(&pdev->dev);
+
+ if (!pm_runtime_status_suspended(&pdev->dev)) {
+ clk_disable_unprepare(prg->clk_axi);
+ clk_disable_unprepare(prg->clk_ipg);
+ }
}
#ifdef CONFIG_PM
--
2.43.0