]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/display: Ensure curve to hw translation succeed
authorAlex Hung <alex.hung@amd.com>
Tue, 11 Jun 2024 16:43:12 +0000 (10:43 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Jun 2024 21:10:38 +0000 (17:10 -0400)
[WHAT & HOW]
Check cm3_helper_translate_curve_to_hw_format runs successfully so the
regamma_params is valid and can be used.

Also revmoed two result assignments.

This fixes 2 CHECKED_RETURN UNUSED_VALUE issues reported by Coverity.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c

index bcacfd893cf7e27a8cfbee59614ede314a3c353e..eaeeade31ed74f813e74c248a57191cf39626ce2 100644 (file)
@@ -228,8 +228,11 @@ bool dcn30_set_blend_lut(
        if (plane_state->blend_tf.type == TF_TYPE_HWPWL)
                blend_lut = &plane_state->blend_tf.pwl;
        else if (plane_state->blend_tf.type == TF_TYPE_DISTRIBUTED_POINTS) {
-               cm3_helper_translate_curve_to_hw_format(
+               result = cm3_helper_translate_curve_to_hw_format(
                                &plane_state->blend_tf, &dpp_base->regamma_params, false);
+               if (!result)
+                       return result;
+
                blend_lut = &dpp_base->regamma_params;
        }
        result = dpp_base->funcs->dpp_program_blnd_lut(dpp_base, blend_lut);
index fe62478fbcde0f4aba742531cd89803284c2d6c2..05d8f81daa064d72549af336c24f943eb3307123 100644 (file)
@@ -483,11 +483,14 @@ bool dcn32_set_mcm_luts(
        if (plane_state->blend_tf.type == TF_TYPE_HWPWL)
                lut_params = &plane_state->blend_tf.pwl;
        else if (plane_state->blend_tf.type == TF_TYPE_DISTRIBUTED_POINTS) {
-               cm3_helper_translate_curve_to_hw_format(&plane_state->blend_tf,
+               result = cm3_helper_translate_curve_to_hw_format(&plane_state->blend_tf,
                                &dpp_base->regamma_params, false);
+               if (!result)
+                       return result;
+
                lut_params = &dpp_base->regamma_params;
        }
-       result = mpc->funcs->program_1dlut(mpc, lut_params, mpcc_id);
+       mpc->funcs->program_1dlut(mpc, lut_params, mpcc_id);
        lut_params = NULL;
 
        // Shaper
@@ -501,7 +504,7 @@ bool dcn32_set_mcm_luts(
                lut_params = &dpp_base->shaper_params;
        }
 
-       result = mpc->funcs->program_shaper(mpc, lut_params, mpcc_id);
+       mpc->funcs->program_shaper(mpc, lut_params, mpcc_id);
 
        // 3D
        if (plane_state->lut3d_func.state.bits.initialized == 1)