[PATCH v2] drm/amdgpu: Fix uninitialized return value

Zhang, Hawking Hawking.Zhang at amd.com
Tue Nov 28 02:55:19 UTC 2023


[AMD Official Use Only - General]

Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>

Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <Lijo.Lazar at amd.com>
Sent: Tuesday, November 28, 2023 02:56
To: amd-gfx at lists.freedesktop.org
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: [PATCH v2] drm/amdgpu: Fix uninitialized return value

The return value is uniinitialized if ras context is NULL.

Fixes: 0f4c8faa043c (drm/amdgpu: Move mca debug mode decision to ras)

Signed-off-by: Lijo Lazar <lijo.lazar at amd.com>
---
v2: Avoid variable initialization (Christian)

 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 1a8668a63e67..79fae180639a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -3416,6 +3416,8 @@ int amdgpu_ras_set_mca_debug_mode(struct amdgpu_device *adev, bool enable)
                ret = amdgpu_mca_smu_set_debug_mode(adev, enable);
                if (!ret)
                        con->is_mca_debug_mode = enable;
+       } else {
+               ret = 0;
        }

        return ret;
--
2.25.1



More information about the amd-gfx mailing list