drm/vc4: kms: Warn if clk_set_min_rate fails
authorMaxime Ripard <maxime@cerno.tech>
Fri, 25 Mar 2022 14:48:48 +0000 (15:48 +0100)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Fri, 22 Apr 2022 09:17:27 +0000 (10:17 +0100)
We currently ignore the clk_set_min_rate return code assuming it would
succeed. However, it can fail if we ask for a rate higher than the
current maximum for example.

Since we can't fail in atomic_commit, at least warn on failure.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_kms.c

index a05482e..a41d3c8 100644 (file)
@@ -400,7 +400,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
                unsigned long core_rate = max_t(unsigned long,
                                                500000000, state_rate);
 
-               clk_set_min_rate(hvs->core_clk, core_rate);
+               WARN_ON(clk_set_min_rate(hvs->core_clk, core_rate));
        }
 
        drm_atomic_helper_commit_modeset_disables(dev, state);
@@ -430,7 +430,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
                drm_dbg(dev, "Running the core clock at %lu Hz\n",
                        new_hvs_state->core_clock_rate);
 
-               clk_set_min_rate(hvs->core_clk, new_hvs_state->core_clock_rate);
+               WARN_ON(clk_set_min_rate(hvs->core_clk, new_hvs_state->core_clock_rate));
 
                drm_dbg(dev, "Core clock actual rate: %lu Hz\n",
                        clk_get_rate(hvs->core_clk));