Skip to content

Commit

Permalink
drm/amd/display: free bo used for dmub bounding box
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Aurabindo Pillai authored and alexdeucher committed Jul 23, 2024
1 parent 748b3c4 commit f59549c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ static struct dml2_soc_bb *dm_dmub_get_vbios_bounding_box(struct amdgpu_device *
/* Send the chunk */
ret = dm_dmub_send_vbios_gpint_command(adev, send_addrs[i], chunk, 30000);
if (ret != DMUB_STATUS_OK)
/* No need to free bb here since it shall be done unconditionally <elsewhere> */
/* No need to free bb here since it shall be done in dm_sw_fini() */
return NULL;
}

Expand Down Expand Up @@ -2465,8 +2465,17 @@ static int dm_sw_init(void *handle)
static int dm_sw_fini(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
struct dal_allocation *da;

list_for_each_entry(da, &adev->dm.da_list, list) {
if (adev->dm.bb_from_dmub == (void *) da->cpu_ptr) {
amdgpu_bo_free_kernel(&da->bo, &da->gpu_addr, &da->cpu_ptr);
list_del(&da->list);
kfree(da);
break;
}
}

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

kfree(adev->dm.dmub_fb_info);
Expand Down

0 comments on commit f59549c

Please sign in to comment.