[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6f24d0cb-ce14-4e56-990b-00ad579bc282@amd.com>
Date: Tue, 7 Oct 2025 21:15:27 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: Eslam Khafagy <eslam.medhat1993@...il.com>,
Harry Wentland <harry.wentland@....com>, Leo Li <sunpeng.li@....com>,
Rodrigo Siqueira <siqueira@...lia.com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Alex Hung <alex.hung@....com>, Wayne Lin <Wayne.Lin@....com>,
Aurabindo Pillai <aurabindo.pillai@....com>,
Tom Chung <chiahsuan.chung@....com>,
Dominik Kaszewski <dominik.kaszewski@....com>,
Yilin Chen <Yilin.Chen@....com>,
"open list:AMD DISPLAY CORE" <amd-gfx@...ts.freedesktop.org>,
"open list:DRM DRIVERS" <dri-devel@...ts.freedesktop.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND] drm/amd/display: Initialize return value in
dm_cache_state()
On 10/7/2025 5:45 PM, Eslam Khafagy wrote:
> Initialize the return variable "r" to 0 in dm_cache_state() to fix
> a potential use of uninitialized variable warning.
>
> The return value for this function might not be a PTR_ERR, in casse if
> condition fails. In that case we ensure predictable reutrn.
Can you walk me through your thought process? I looked at all possible
returns for drm_atomic_helper_suspend() and they all return ERR_PTR() or
a state.
So I don't see how the IS_ERR() clause could have a problem.
>
> Signed-off-by: Eslam Khafagy <eslam.medhat1993@...il.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 8e1622bf7a42..6b4f3eb9ce48 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3115,7 +3115,7 @@ static void hpd_rx_irq_work_suspend(struct amdgpu_display_manager *dm)
>
> static int dm_cache_state(struct amdgpu_device *adev)
> {
> - int r;
> + int r = 0;
>
> adev->dm.cached_state = drm_atomic_helper_suspend(adev_to_drm(adev));
> if (IS_ERR(adev->dm.cached_state)) {
Powered by blists - more mailing lists