1 From 60ed238e2225599540e47a95ecf50313cca9459e Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Tue, 29 Jun 2021 11:36:38 +0200
4 Subject: [PATCH] drm/vc4: hdmi: Put the device on error in
7 In the vc4_hdmi_encoder_pre_crtc_configure() function error path we
8 never actually call pm_runtime_put() even though
9 pm_runtime_resume_and_get() is our very first call.
11 Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
12 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 drivers/gpu/drm/vc4/vc4_hdmi.c | 6 ++++++
15 1 file changed, 6 insertions(+)
17 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
18 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
19 @@ -901,6 +901,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
20 ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
22 DRM_ERROR("Failed to retain power domain: %d\n", ret);
23 + pm_runtime_put(&vc4_hdmi->pdev->dev);
27 @@ -908,12 +909,14 @@ static void vc4_hdmi_encoder_pre_crtc_co
28 ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate);
30 DRM_ERROR("Failed to set pixel clock rate: %d\n", ret);
31 + pm_runtime_put(&vc4_hdmi->pdev->dev);
35 ret = clk_prepare_enable(vc4_hdmi->pixel_clock);
37 DRM_ERROR("Failed to turn on pixel clock: %d\n", ret);
38 + pm_runtime_put(&vc4_hdmi->pdev->dev);
42 @@ -921,6 +924,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
43 vc4_hdmi->hsm_req = clk_request_start(vc4_hdmi->hsm_clock, hsm_rate);
44 if (IS_ERR(vc4_hdmi->hsm_req)) {
45 DRM_ERROR("Failed to set HSM clock rate: %ld\n", PTR_ERR(vc4_hdmi->hsm_req));
46 + pm_runtime_put(&vc4_hdmi->pdev->dev);
50 @@ -942,6 +946,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
51 clk_request_done(vc4_hdmi->hsm_req);
52 clk_disable_unprepare(vc4_hdmi->hsm_clock);
53 clk_disable_unprepare(vc4_hdmi->pixel_clock);
54 + pm_runtime_put(&vc4_hdmi->pdev->dev);
58 @@ -953,6 +958,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
59 clk_request_done(vc4_hdmi->hsm_req);
60 clk_disable_unprepare(vc4_hdmi->hsm_clock);
61 clk_disable_unprepare(vc4_hdmi->pixel_clock);
62 + pm_runtime_put(&vc4_hdmi->pdev->dev);