diff mbox series

drm/panel: Add missing pm_rumtime_resume_and_get

Message ID 1642580361-27552-1-git-send-email-lyz_cs@pku.edu.cn (mailing list archive)
State New, archived
Headers show
Series drm/panel: Add missing pm_rumtime_resume_and_get | expand

Commit Message

刘永志 Jan. 19, 2022, 8:19 a.m. UTC
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@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 mbox series

Patch

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;