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

Lijo Lazar lijo.lazar at amd.com
Mon Nov 27 18:56:15 UTC 2023


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