drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo
Subsystems (2)
PATCH 1/1 drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo
When psp_hw_init failed, it will set the load_type to AMDGPU_FW_LOAD_DIRECT. During amdgpu_device_ip_fini, amdgpu_ucode_free_bo checks that load_type is AMDGPU_FW_LOAD_DIRECT and skips deallocating fw_buf causing memory leak. Remove load_type check in amdgpu_ucode_free_bo.
Signed-off-by Alice Wong <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -2
@@ -714,8 +714,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)void amdgpu_ucode_free_bo (struct amdgpu_device *adev) { -if (adev->firmware.load_type !=AMDGPU_FW_LOAD_DIRECT ) -amdgpu_bo_free_kernel (&adev->firmware.fw_buf, +amdgpu_bo_free_kernel (&adev->firmware.fw_buf, &adev->firmware.fw_buf_mc, &adev->firmware.fw_buf_ptr); }
Signature · 1 line
2.25.1
Quoted 7 lines · Alice Wong
When
psp_hw_initfailed, it will set theload_typetoAMDGPU_FW_LOAD_DIRECT. Duringamdgpu_device_ip_fini,amdgpu_ucode_free_bochecks thatload_typeisAMDGPU_FW_LOAD_DIRECTand skips deallocatingfw_bufcausing memory leak. Removeload_typecheck inamdgpu_ucode_free_bo.Signed-off-by Alice Wong <[email protected]>
Reviewed-by Alex Deucher <[email protected]>
Quoted 21 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1
-3@@ -714,8 +714,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)void amdgpu_ucode_free_bo (struct amdgpu_device *adev) { -if (adev->firmware.load_type !=AMDGPU_FW_LOAD_DIRECT ) -amdgpu_bo_free_kernel (&adev->firmware.fw_buf, +amdgpu_bo_free_kernel (&adev->firmware.fw_buf, &adev->firmware.fw_buf_mc, &adev->firmware.fw_buf_ptr); } --2.25.1