[PATCH] drm/amd/display: Replace ternary operator with min() in 'dm_helpers_parse_edid_caps'

Hamza Mahfooz hamza.mahfooz at amd.com
Mon Aug 14 11:50:55 UTC 2023


On 8/13/23 04:46, Srinivasan Shanmugam wrote:
> Fixes the following coccicheck:
> 
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c:120:41-42: WARNING opportunity for min()
> 
> Cc: Harry Wentland <harry.wentland at amd.com>
> Cc: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>

Reviewed-by: Hamza Mahfooz <hamza.mahfooz at amd.com>

> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> index e94eeeb97688..4b230933b28e 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
> @@ -117,7 +117,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
>   	if (sad_count <= 0)
>   		return result;
>   
> -	edid_caps->audio_mode_count = sad_count < DC_MAX_AUDIO_DESC_COUNT ? sad_count : DC_MAX_AUDIO_DESC_COUNT;
> +	edid_caps->audio_mode_count = min(sad_count, DC_MAX_AUDIO_DESC_COUNT);
>   	for (i = 0; i < edid_caps->audio_mode_count; ++i) {
>   		struct cea_sad *sad = &sads[i];
>   
-- 
Hamza



More information about the amd-gfx mailing list