[PATCH] drm/panel: Add missing pm_rumtime_resume_and_get

Yongzhi Liu lyz_cs at pku.edu.cn
Wed Jan 19 08:19:21 UTC 2022


pm_runtime_put_autosuspend() and pm_runtime_put_sync_suspend()
will decrease the rumtime PM counter even when it returns an error.
Thus a pairing decrement is needed to prevent refcount leak.
Fix this by adding pm_runtime_resume_and_get() on error handling path.

Signed-off-by: Yongzhi Liu <lyz_cs at pku.edu.cn>
---
 drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 4 +++-
 drivers/gpu/drm/panel/panel-simple.c             | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
index 20666b6..dd7e3f1 100644
--- a/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
+++ b/drivers/gpu/drm/panel/panel-samsung-atna33xc20.c
@@ -189,8 +189,10 @@ static int atana33xc20_unprepare(struct drm_panel *panel)
 	 * to get the EDID or otherwise send DP AUX commands to the panel.
 	 */
 	ret = pm_runtime_put_sync_suspend(panel->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_resume_and_get(panel->dev);
 		return ret;
+	}
 	p->prepared = false;
 
 	return 0;
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 9e46db5..ad18965 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -323,8 +323,10 @@ static int panel_simple_unprepare(struct drm_panel *panel)
 
 	pm_runtime_mark_last_busy(panel->dev);
 	ret = pm_runtime_put_autosuspend(panel->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_resume_and_get(panel->dev);
 		return ret;
+	}
 	p->prepared = false;
 
 	return 0;
-- 
2.7.4



More information about the dri-devel mailing list