[PATCH 3/4] drm/omap: hdmi4: fix reference leak in hdmi_runtime_get

Zhang Qilong zhangqilong3 at huawei.com
Tue Nov 10 12:51:07 UTC 2020


pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference leak in hdmi_runtime_get, so we should fix it.

Fixes: ac7674567c620 ("drm: omapdrm: hdmi4: Allocate the omap_hdmi data structure dynamically")
Signed-off-by: Zhang Qilong <zhangqilong3 at huawei.com>
---
 drivers/gpu/drm/omapdrm/dss/hdmi4.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index a14fbf06cb30..33f12c351b08 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -44,8 +44,10 @@ static int hdmi_runtime_get(struct omap_hdmi *hdmi)
 
 	r = pm_runtime_get_sync(&hdmi->pdev->dev);
 	WARN_ON(r < 0);
-	if (r < 0)
+	if (r < 0) {
+		pm_runtime_put_noidle(&hdmi->pdev->dev);
 		return r;
+	}
 
 	return 0;
 }
-- 
2.25.4



More information about the dri-devel mailing list