pm_runtime_get_sync() increments the runtime PM usage counter even when it
returns an error. panfrost_remove() uses it to keep the GPU active while
runtime PM is disabled and the device is finalized, but the usage counter
is not dropped afterwards.

Balance the get with pm_runtime_put_noidle() after disabling runtime PM.
This drops the extra usage count without requesting a runtime suspend,
preserving the existing teardown sequence that avoids suspending after
panfrost_device_fini().

Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload")
Signed-off-by: Ruoyu Wang <[email protected]>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c 
b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 074c0995ddc26..d78ea7d4d099e 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -1027,6 +1027,7 @@ static void panfrost_remove(struct platform_device *pdev)
 
        pm_runtime_get_sync(pfdev->base.dev);
        pm_runtime_disable(pfdev->base.dev);
+       pm_runtime_put_noidle(pfdev->base.dev);
        panfrost_device_fini(pfdev);
        pm_runtime_set_suspended(pfdev->base.dev);
 }
-- 
2.51.0

Reply via email to