Skip to contentSkip to conversation

drm/amdgpu: Free ucode bo memory during load failure v1

PATCH New Alice Wong 1 participant 2 messages Apr 19, 2022

Subsystems (2)
lore
Share & tools
lore

Alice Wong

author
#0 lore raw

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

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

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +3 -4
index ca3350502618..da787cc2b6b8 100644
@@ -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)
Signature · 1 line
2.25.1
#1 lore raw

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

[AMD Official Use Only]

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

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +3 -5
index ca3350502618..da787cc2b6b8 100644
@@ -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