ec225841b42b3abb88be32e6920c256bcf35fb80
[openwrt/staging/dangole.git] /
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
5 pre_crtc_configure
6
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.
10
11 Fixes: 4f6e3d66ac52 ("drm/vc4: Add runtime PM support to the HDMI encoder driver")
12 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
13 ---
14 drivers/gpu/drm/vc4/vc4_hdmi.c | 6 ++++++
15 1 file changed, 6 insertions(+)
16
17 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
18 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
19 @@ -900,6 +900,7 @@ static void vc4_hdmi_encoder_pre_crtc_co
20 ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
21 if (ret < 0) {
22 DRM_ERROR("Failed to retain power domain: %d\n", ret);
23 + pm_runtime_put(&vc4_hdmi->pdev->dev);
24 return;
25 }
26
27 @@ -907,12 +908,14 @@ static void vc4_hdmi_encoder_pre_crtc_co
28 ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate);
29 if (ret) {
30 DRM_ERROR("Failed to set pixel clock rate: %d\n", ret);
31 + pm_runtime_put(&vc4_hdmi->pdev->dev);
32 return;
33 }
34
35 ret = clk_prepare_enable(vc4_hdmi->pixel_clock);
36 if (ret) {
37 DRM_ERROR("Failed to turn on pixel clock: %d\n", ret);
38 + pm_runtime_put(&vc4_hdmi->pdev->dev);
39 return;
40 }
41
42 @@ -920,6 +923,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);
47 return;
48 }
49
50 @@ -941,6 +945,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);
55 return;
56 }
57
58 @@ -952,6 +957,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);
63 return;
64 }
65