From: Dmitry Baryshkov <[email protected]> Currently memory used for writeback connectors isn't freed on driver unbinding, leaking the memory. Use drm_device-memory allocation function for the writeback connector, making sure that the memory is freed on the driver unbinding.
v2: Fixed missing parameter Reported-by: Christophe JAILLET <[email protected]> Suggested-by: Alex Hung <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: John Harrison <[email protected]> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 67b825cbb88f..1fd48e28f5fe 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -96,6 +96,7 @@ #include <drm/drm_fourcc.h> #include <drm/drm_edid.h> #include <drm/drm_eld.h> +#include <drm/drm_managed.h> #include <drm/drm_mode.h> #include <drm/drm_utils.h> #include <drm/drm_vblank.h> @@ -2597,7 +2598,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) link = dc_get_link_at_index(dm->dc, i); if (link->connector_signal == SIGNAL_TYPE_VIRTUAL) { - struct amdgpu_dm_wb_connector *wbcon = kzalloc_obj(*wbcon); + struct amdgpu_dm_wb_connector *wbcon = drmm_kzalloc_obj(adev_to_drm(adev), *wbcon); if (!wbcon) { drm_err(adev_to_drm(adev), "KMS: Failed to allocate writeback connector\n"); @@ -2606,7 +2607,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) if (amdgpu_dm_wb_connector_init(dm, wbcon, i)) { drm_err(adev_to_drm(adev), "KMS: Failed to initialize writeback connector\n"); - kfree(wbcon); + drmm_kfree(adev_to_drm(adev), wbcon); continue; } -- 2.43.0
