[PATCH] drm/panfrost: fix runtime pm imbalance on error

Dinghao Liu dinghao.liu at zju.edu.cn
Wed May 20 11:05:04 UTC 2020


pm_runtime_get_sync() increments the runtime PM usage counter even
the call returns an error code. Thus a pairing decrement is needed
on the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu at zju.edu.cn>
---
 drivers/gpu/drm/panfrost/panfrost_job.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index 7914b1570841..5719e356c969 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -146,8 +146,10 @@ static void panfrost_job_hw_submit(struct panfrost_job *job, int js)
 	int ret;
 
 	ret = pm_runtime_get_sync(pfdev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_sync_autosuspend(pfdev->dev);
 		return;
+	}
 
 	if (WARN_ON(job_read(pfdev, JS_COMMAND_NEXT(js)))) {
 		pm_runtime_put_sync_autosuspend(pfdev->dev);
-- 
2.17.1



More information about the dri-devel mailing list