[PATCH 2/2] drm/amdgpu: Free ucode bo memory during load failure v1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove firmware.load_type check in amdgpu_ucode_free_bo.
If psp failed to load a firmware, it will set formware.load_type to
AMDGPU_FW_LOAD_DIRECT for bring up purposes. This caused memory leak
as amdpug_ucode_free_bo will skip freeing memory due to the load_type.

BUG:SWDEV-332449

Signed-off-by: Alice Wong <shiwei.wong@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index ca3350502618..da787cc2b6b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -714,10 +714,9 @@ 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,
-		&adev->firmware.fw_buf_mc,
-		&adev->firmware.fw_buf_ptr);
+	amdgpu_bo_free_kernel(&adev->firmware.fw_buf,
+						&adev->firmware.fw_buf_mc,
+						&adev->firmware.fw_buf_ptr);
 }
 
 int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
-- 
2.25.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux