Skip to content

Commit f59549c

Browse files
Aurabindo Pillaialexdeucher
Aurabindo Pillai
authored andcommitted
drm/amd/display: free bo used for dmub bounding box
fix a memleak introduced by not removing the buffer object for use with early dmub bounding box value storage Fixes: 234e945 ("drm/amd/display: Enable copying of bounding box data from VBIOS DMUB") Reviewed-by: Rodrigo Siqueira <[email protected]> Reviewed-by: Alex Hung <[email protected]> Signed-off-by: Jerry Zuo <[email protected]> Signed-off-by: Aurabindo Pillai <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 748b3c4 commit f59549c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ static struct dml2_soc_bb *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *
17401740
/* Send the chunk */
17411741
ret = dm_dmub_send_vbios_gpint_command(adev, send_addrs[i], chunk, 30000);
17421742
if (ret != DMUB_STATUS_OK)
1743-
/* No need to free bb here since it shall be done unconditionally <elsewhere> */
1743+
/* No need to free bb here since it shall be done in dm_sw_fini() */
17441744
return NULL;
17451745
}
17461746

@@ -2465,8 +2465,17 @@ static int dm_sw_init(void *handle)
24652465
static int dm_sw_fini(void *handle)
24662466
{
24672467
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
2468+
struct dal_allocation *da;
2469+
2470+
list_for_each_entry(da, &adev->dm.da_list, list) {
2471+
if (adev->dm.bb_from_dmub == (void *) da->cpu_ptr) {
2472+
amdgpu_bo_free_kernel(&da->bo, &da->gpu_addr, &da->cpu_ptr);
2473+
list_del(&da->list);
2474+
kfree(da);
2475+
break;
2476+
}
2477+
}
24682478

2469-
kfree(adev->dm.bb_from_dmub);
24702479
adev->dm.bb_from_dmub = NULL;
24712480

24722481
kfree(adev->dm.dmub_fb_info);

0 commit comments

Comments
 (0)