From 60ed238e2225599540e47a95ecf50313cca9459e Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Tue, 29 Jun 2021 11:36:38 +0200 Subject: [PATCH] drm/vc4: hdmi: Put the device on error in pre_crtc_configure In the vc4_hdmi_encoder_pre_crtc_configure() function error path we never actually call pm_runtime_put() even though pm_runtime_resume_and_get() is our very first call. Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver") Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -901,6 +901,7 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); if (ret < 0) { DRM_ERROR("Failed to retain power domain: %d\n", ret); + pm_runtime_put(&vc4_hdmi->pdev->dev); return; } @@ -908,12 +909,14 @@ static void vc4_hdmi_encoder_pre_crtc_co ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate); if (ret) { DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); + pm_runtime_put(&vc4_hdmi->pdev->dev); return; } ret = clk_prepare_enable(vc4_hdmi->pixel_clock); if (ret) { DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); + pm_runtime_put(&vc4_hdmi->pdev->dev); return; } @@ -921,6 +924,7 @@ static void vc4_hdmi_encoder_pre_crtc_co vc4_hdmi->hsm_req = clk_request_start(vc4_hdmi->hsm_clock, hsm_rate); if (IS_ERR(vc4_hdmi->hsm_req)) { DRM_ERROR("Failed to set HSM clock rate: %ld\n", PTR_ERR(vc4_hdmi->hsm_req)); + pm_runtime_put(&vc4_hdmi->pdev->dev); return; } @@ -942,6 +946,7 @@ static void vc4_hdmi_encoder_pre_crtc_co clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); + pm_runtime_put(&vc4_hdmi->pdev->dev); return; } @@ -953,6 +958,7 @@ static void vc4_hdmi_encoder_pre_crtc_co clk_request_done(vc4_hdmi->hsm_req); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); + pm_runtime_put(&vc4_hdmi->pdev->dev); return; }