Commit ee41e5b6 authored by Zilin Guan's avatar Zilin Guan Committed by Alex Deucher
Browse files

drm/amdgpu: Fix memory leak in amdgpu_ras_init()



When amdgpu_nbio_ras_sw_init() fails in amdgpu_ras_init(), the function
returns directly without freeing the allocated con structure, leading
to a memory leak.

Fix this by jumping to the release_con label to properly clean up the
allocated memory before returning the error code.

Compile tested only. Issue found using a prototype static analysis tool
and code review.

Fixes: fdc94d3a ("drm/amdgpu: Rework pcie_bif ras sw_init")
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarZilin Guan <zilin@seu.edu.cn>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0c44d619
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4352,7 +4352,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
	 * to handle fatal error */
	r = amdgpu_nbio_ras_sw_init(adev);
	if (r)
		return r;
		goto release_con;

	if (adev->nbio.ras &&
	    adev->nbio.ras->init_ras_controller_interrupt) {