From dc2c4219ea0db535581b37c0ae760c56c6a08b2d Mon Sep 17 00:00:00 2001 From: Xiang Liu Date: Fri, 21 Aug 2026 23:37:43 +0800 Subject: [PATCH] drm/amd/ras: drop the RAS module state when its sw init fails The failure paths free the RAS manager but keep the flags that advertise it as the owner of RAS and of the RAS firmware load. Every entry point gated on those hits the NULL manager, hw_init turns that into -EINVAL and the whole probe fails. Clear both once the manager is gone, and route the allocation failure through the same place. Signed-off-by: Xiang Liu Reviewed-by: Tao Zhou Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c index b41117deb5f3..a02167397ce2 100644 --- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c @@ -337,8 +337,10 @@ int amdgpu_ras_mgr_sw_init(struct amdgpu_device *adev, struct ras_module_param * con->uniras_load_ras_fw = true; ras_mgr = kzalloc_obj(*ras_mgr); - if (!ras_mgr) - return -EINVAL; + if (!ras_mgr) { + ret = -EINVAL; + goto err1; + } con->ras_mgr = ras_mgr; ras_mgr->adev = adev; @@ -385,6 +387,8 @@ err2: err1: kfree(ras_mgr); con->ras_mgr = NULL; + con->uniras_enabled = false; + con->uniras_load_ras_fw = false; return ret; }