hdmi_pll_enable() acquires a runtime PM reference with
pm_runtime_get_sync() and then returns the -ETIMEDOUT error from
hdmi_wp_set_pll_pwr() without releasing it.  The callers of
dss_pll_enable() (hdmi4.c, hdmi5.c, dpi.c and dsi.c) do not call
dss_pll_disable() when enabling fails, so the reference is never
dropped and the HDMI device can no longer be runtime suspended.

Release the runtime PM reference and undo the dss_ctrl_pll_enable()
call on that error path.  Also drop the reference with
pm_runtime_put_noidle() when pm_runtime_get_sync() itself fails.

Fixes: 86c9305c864c ("drm/omap: HDMI PLL: use runtime pm")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <[email protected]>
---
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index eea719243eaf..9b900fc88f5f 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -43,13 +43,19 @@ static int hdmi_pll_enable(struct dss_pll *dsspll)
        int r;
 
        r = pm_runtime_get_sync(&pll->pdev->dev);
-       WARN_ON(r < 0);
+       if (WARN_ON(r < 0)) {
+               pm_runtime_put_noidle(&pll->pdev->dev);
+               return r;
+       }
 
        dss_ctrl_pll_enable(dsspll, true);
 
        r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
-       if (r)
+       if (r) {
+               dss_ctrl_pll_enable(dsspll, false);
+               pm_runtime_put_sync(&pll->pdev->dev);
                return r;
+       }
 
        return 0;
 }
-- 
2.25.1

Reply via email to