public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: Remove the redundant NULL check
@ 2025-04-02 14:21 Ваторопин Андрей
  2025-04-03  1:30 ` Alex Hung
  0 siblings, 1 reply; 2+ messages in thread
From: Ваторопин Андрей @ 2025-04-02 14:21 UTC (permalink / raw)
  To: Harry Wentland
  Cc: Ваторопин Андрей,
	Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Alex Hung, Dillon Varone, Roman Li,
	Ethan Carter Edwards, Ivan Lipski, Iswara Nagulendran, Hersen Wu,
	Rafal Ostrowski, Alvin Lee, Aric Cyr, Dr. David Alan Gilbert,
	Srinivasan Shanmugam, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org

From: Andrey Vatoropin <a.vatoropin@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@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)
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: Remove the redundant NULL check
  2025-04-02 14:21 [PATCH] drm/amd/display: Remove the redundant NULL check Ваторопин Андрей
@ 2025-04-03  1:30 ` Alex Hung
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Hung @ 2025-04-03  1:30 UTC (permalink / raw)
  To: Ваторопин Андрей,
	Harry Wentland
  Cc: Leo Li, Rodrigo Siqueira, Alex Deucher, Christian König,
	David Airlie, Simona Vetter, Dillon Varone, Roman Li,
	Ethan Carter Edwards, Ivan Lipski, Iswara Nagulendran, Hersen Wu,
	Rafal Ostrowski, Alvin Lee, Aric Cyr, Dr. David Alan Gilbert,
	Srinivasan Shanmugam, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org

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

On 4/2/25 08:21, Ваторопин Андрей wrote:
> From: Andrey Vatoropin <a.vatoropin@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@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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-03  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 14:21 [PATCH] drm/amd/display: Remove the redundant NULL check Ваторопин Андрей
2025-04-03  1:30 ` Alex Hung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox