[PATCH 3/3] drm/amdgpu: Fix the uninitialized variable warning

Deucher, Alexander Alexander.Deucher at amd.com
Wed Apr 24 18:21:24 UTC 2024


[AMD Official Use Only - General]

> -----Original Message-----
> From: Ma, Jun <Jun.Ma2 at amd.com>
> Sent: Wednesday, April 24, 2024 6:04 AM
> To: amd-gfx at lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: Ma, Jun <Jun.Ma2 at amd.com>
> Subject: [PATCH 3/3] drm/amdgpu: Fix the uninitialized variable warning
>
> Initialize the phy_id to 0 to fix the warning of "Using uninitialized value phy_id"
>
> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> index 8ed0e073656f..df81078aa26d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c
> @@ -95,7 +95,7 @@ static ssize_t
> amdgpu_securedisplay_debugfs_write(struct file *f, const char __u
>       struct psp_context *psp = &adev->psp;
>       struct ta_securedisplay_cmd *securedisplay_cmd;
>       struct drm_device *dev = adev_to_drm(adev);
> -     uint32_t phy_id;
> +     uint32_t phy_id = 0;

Would be better to return an error in case 2: below if size < 3.  Otherwise we are just blindly using 0 for phy id.

Alex

>       uint32_t op;
>       char str[64];
>       int ret;
> --
> 2.34.1



More information about the amd-gfx mailing list