[PATCH] drm/amd/display: Remove the redundant NULL check

Alex Hung alex.hung at amd.com
Thu Apr 3 01:30:17 UTC 2025


Reviewed-by: Alex Hung <alex.hung at amd.com>

On 4/2/25 08:21, Ваторопин Андрей wrote:
> From: Andrey Vatoropin <a.vatoropin at crpt.ru>
> 
> Static analysis shows that pointer "timing" cannot be NULL because it
> points to the object "struct dc_crtc_timing".
> 
> Remove the extra NULL check. It is meaningless and harms the readability
> of the code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Andrey Vatoropin <a.vatoropin at crpt.ru>
> ---
>   drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c
> index 13202ce30d66..76e8c4dcf339 100644
> --- a/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c
> +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c
> @@ -1891,8 +1891,6 @@ static int get_refresh_rate(struct dc_state *context)
>   
>   	/* check if refresh rate at least 120hz */
>   	timing = &context->streams[0]->timing;
> -	if (timing == NULL)
> -		return 0;
>   
>   	h_v_total = timing->h_total * timing->v_total;
>   	if (h_v_total == 0)



More information about the amd-gfx mailing list