[PATCH 2/2] drm/amd/ras: drop the RAS module state when its sw init fails
Xiang Liu <[email protected]>
| Newsgroups | org.freedesktop.lists.amd-gfx |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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 @@ int amdgpu_ras_mgr_sw_init(struct amdgpu_device *adev, struct ras_module_param * err1: kfree(ras_mgr); con->ras_mgr = NULL; + con->uniras_enabled = false; + con->uniras_load_ras_fw = false; return ret; } -- 2.34.1