[SRU][H/raspi][PATCH 3/7] drm/vc4: hdmi: Fix bvb clock enable error checking

Juerg Haefliger juerg.haefliger at canonical.com
Mon Oct 4 18:16:49 UTC 2021


BugLink: https://bugs.launchpad.net/bugs/1944397

Check for errors only if we actually tried to enable the bvb clock.

Fixes: 01a6d727b407 ("vc4/drm: hdmi: Handle case when bvb clock is null")
Signed-off-by: Juerg Haefliger <juergh at canonical.com>

(forward ported from commit 7c9c402b0cc2ad4eae6b345b9699ab6701b48bc7 linux-rpi)
[juergh: Adjusted context.]
Signed-off-by: Juerg Haefliger <juergh at canonical.com>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 780d06732925..70b2db77e39b 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -951,14 +951,15 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
 	else
 		bvb_rate = 75000000;
 
-	if (vc4_hdmi->pixel_bvb_clock)
+	if (vc4_hdmi->pixel_bvb_clock) {
 		vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock, bvb_rate);
-	if (IS_ERR(vc4_hdmi->bvb_req)) {
-		DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req));
-		clk_request_done(vc4_hdmi->hsm_req);
-		clk_disable_unprepare(vc4_hdmi->pixel_clock);
-		pm_runtime_put(&vc4_hdmi->pdev->dev);
-		return;
+		if (IS_ERR(vc4_hdmi->bvb_req)) {
+			DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req));
+			clk_request_done(vc4_hdmi->hsm_req);
+			clk_disable_unprepare(vc4_hdmi->pixel_clock);
+			pm_runtime_put(&vc4_hdmi->pdev->dev);
+			return;
+		}
 	}
 
 	ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
-- 
2.30.2




More information about the kernel-team mailing list