diff mbox

[v2] drm/amd/display: Use kernel alloc/free

Message ID 20170927213952.9426-1-harry.wentland@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Harry Wentland Sept. 27, 2017, 9:39 p.m. UTC
Abstractions are frowned upon.

cocci script:
virtual context
virtual patch
virtual org
virtual report

@@
expression ptr;
@@

- dm_alloc(ptr)
+ kzalloc(ptr, GFP_KERNEL)

@@
expression ptr, size;
@@

- dm_realloc(ptr, size)
+ krealloc(ptr, size, GFP_KERNEL)

@@
expression ptr;
@@

- dm_free(ptr)
+ kfree(ptr)

v2: use GFP_KERNEL, not GFP_ATOMIC. add cocci script

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/basics/logger.c     | 18 ++++---
 drivers/gpu/drm/amd/display/dc/basics/vector.c     | 19 +++----
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c  | 17 +++---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 14 ++---
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c   |  5 +-
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c   |  6 +--
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 42 ++++++++-------
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |  6 +--
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c  | 18 +++----
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      | 11 ++--
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |  6 +--
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   | 15 +++---
 drivers/gpu/drm/amd/display/dc/dce/dce_abm.c       |  4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_audio.c     |  4 +-
 .../gpu/drm/amd/display/dc/dce/dce_clock_source.c  | 12 +++--
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    | 10 ++--
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c      |  6 +--
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c       |  2 +-
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       |  2 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    | 43 +++++++--------
 .../drm/amd/display/dc/dce110/dce110_compressor.c  |  6 +--
 .../drm/amd/display/dc/dce110/dce110_resource.c    | 61 ++++++++++++----------
 .../drm/amd/display/dc/dce112/dce112_compressor.c  |  6 +--
 .../drm/amd/display/dc/dce112/dce112_resource.c    | 43 +++++++--------
 .../drm/amd/display/dc/dce120/dce120_resource.c    | 43 +++++++--------
 .../drm/amd/display/dc/dce80/dce80_compressor.c    |  6 +--
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  | 47 +++++++++--------
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c   |  2 +-
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c   |  2 +-
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  | 56 ++++++++++----------
 drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c    |  4 +-
 drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c | 21 ++++----
 drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c       |  6 +--
 drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c   |  2 +-
 drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c       |  6 +--
 .../amd/display/dc/i2caux/dce100/i2caux_dce100.c   |  4 +-
 .../display/dc/i2caux/dce110/aux_engine_dce110.c   |  6 +--
 .../dc/i2caux/dce110/i2c_hw_engine_dce110.c        |  7 +--
 .../dc/i2caux/dce110/i2c_sw_engine_dce110.c        |  7 +--
 .../amd/display/dc/i2caux/dce110/i2caux_dce110.c   |  6 +--
 .../amd/display/dc/i2caux/dce112/i2caux_dce112.c   |  4 +-
 .../amd/display/dc/i2caux/dce120/i2caux_dce120.c   |  4 +-
 .../display/dc/i2caux/dce80/i2c_hw_engine_dce80.c  |  6 +--
 .../display/dc/i2caux/dce80/i2c_sw_engine_dce80.c  |  6 +--
 .../drm/amd/display/dc/i2caux/dce80/i2caux_dce80.c |  6 +--
 .../drm/amd/display/dc/i2caux/dcn10/i2caux_dcn10.c |  4 +-
 .../display/dc/i2caux/diagnostics/i2caux_diag.c    |  7 +--
 .../gpu/drm/amd/display/dc/i2caux/i2c_sw_engine.c  |  6 +--
 .../amd/display/dc/irq/dce110/irq_service_dce110.c |  5 +-
 .../amd/display/dc/irq/dce120/irq_service_dce120.c |  5 +-
 .../amd/display/dc/irq/dce80/irq_service_dce80.c   |  5 +-
 .../amd/display/dc/irq/dcn10/irq_service_dcn10.c   |  5 +-
 drivers/gpu/drm/amd/display/dc/irq/irq_service.c   |  2 +-
 .../amd/display/dc/virtual/virtual_link_encoder.c  |  2 +-
 .../display/dc/virtual/virtual_stream_encoder.c    |  4 +-
 .../drm/amd/display/modules/freesync/freesync.c    | 14 ++---
 59 files changed, 362 insertions(+), 330 deletions(-)
diff mbox

Patch

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 36635486b937..dba54c0a7b5f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2429,7 +2429,7 @@  dm_crtc_duplicate_state(struct drm_crtc *crtc)
 	if (WARN_ON(!crtc->state))
 		return NULL;
 
-	state = dm_alloc(sizeof(*state));
+	state = kzalloc(sizeof(*state), GFP_KERNEL);
 
 	__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
 
diff --git a/drivers/gpu/drm/amd/display/dc/basics/logger.c b/drivers/gpu/drm/amd/display/dc/basics/logger.c
index 5895dd3903a3..afb6d2d80e0c 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/logger.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/logger.c
@@ -70,8 +70,8 @@  static bool construct(struct dc_context *ctx, struct dal_logger *logger,
 {
 	/* malloc buffer and init offsets */
 	logger->log_buffer_size = DAL_LOGGER_BUFFER_MAX_SIZE;
-	logger->log_buffer = (char *)dm_alloc(logger->log_buffer_size *
-		sizeof(char));
+	logger->log_buffer = (char *)kzalloc(logger->log_buffer_size * sizeof(char),
+					     GFP_KERNEL);
 
 	if (!logger->log_buffer)
 		return false;
@@ -97,7 +97,7 @@  static bool construct(struct dc_context *ctx, struct dal_logger *logger,
 static void destruct(struct dal_logger *logger)
 {
 	if (logger->log_buffer) {
-		dm_free(logger->log_buffer);
+		kfree(logger->log_buffer);
 		logger->log_buffer = NULL;
 	}
 }
@@ -105,12 +105,13 @@  static void destruct(struct dal_logger *logger)
 struct dal_logger *dal_logger_create(struct dc_context *ctx, uint32_t log_mask)
 {
 	/* malloc struct */
-	struct dal_logger *logger = dm_alloc(sizeof(struct dal_logger));
+	struct dal_logger *logger = kzalloc(sizeof(struct dal_logger),
+					    GFP_KERNEL);
 
 	if (!logger)
 		return NULL;
 	if (!construct(ctx, logger, log_mask)) {
-		dm_free(logger);
+		kfree(logger);
 		return NULL;
 	}
 
@@ -122,7 +123,7 @@  uint32_t dal_logger_destroy(struct dal_logger **logger)
 	if (logger == NULL || *logger == NULL)
 		return 1;
 	destruct(*logger);
-	dm_free(*logger);
+	kfree(*logger);
 	*logger = NULL;
 
 	return 0;
@@ -390,7 +391,8 @@  void dm_logger_open(
 	entry->type = log_type;
 	entry->logger = logger;
 
-	entry->buf = dm_alloc(DAL_LOGGER_BUFFER_MAX_SIZE * sizeof(char));
+	entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE * sizeof(char),
+			     GFP_KERNEL);
 
 	entry->buf_offset = 0;
 	entry->max_buf_bytes = DAL_LOGGER_BUFFER_MAX_SIZE * sizeof(char);
@@ -421,7 +423,7 @@  void dm_logger_close(struct log_entry *entry)
 
 cleanup:
 	if (entry->buf) {
-		dm_free(entry->buf);
+		kfree(entry->buf);
 		entry->buf = NULL;
 		entry->buf_offset = 0;
 		entry->max_buf_bytes = 0;
diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c
index bb72a1857160..e00fc4db3ac4 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/vector.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c
@@ -40,7 +40,7 @@  bool dal_vector_construct(
 		return false;
 	}
 
-	vector->container = dm_alloc(struct_size * capacity);
+	vector->container = kzalloc(struct_size * capacity, GFP_KERNEL);
 	if (vector->container == NULL)
 		return false;
 	vector->capacity = capacity;
@@ -67,7 +67,7 @@  bool dal_vector_presized_costruct(
 		return false;
 	}
 
-	vector->container = dm_alloc(struct_size * count);
+	vector->container = kzalloc(struct_size * count, GFP_KERNEL);
 
 	if (vector->container == NULL)
 		return false;
@@ -95,7 +95,7 @@  struct vector *dal_vector_presized_create(
 	void *initial_value,
 	uint32_t struct_size)
 {
-	struct vector *vector = dm_alloc(sizeof(struct vector));
+	struct vector *vector = kzalloc(sizeof(struct vector), GFP_KERNEL);
 
 	if (vector == NULL)
 		return NULL;
@@ -105,7 +105,7 @@  struct vector *dal_vector_presized_create(
 		return vector;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(vector);
+	kfree(vector);
 	return NULL;
 }
 
@@ -114,7 +114,7 @@  struct vector *dal_vector_create(
 	uint32_t capacity,
 	uint32_t struct_size)
 {
-	struct vector *vector = dm_alloc(sizeof(struct vector));
+	struct vector *vector = kzalloc(sizeof(struct vector), GFP_KERNEL);
 
 	if (vector == NULL)
 		return NULL;
@@ -123,7 +123,7 @@  struct vector *dal_vector_create(
 		return vector;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(vector);
+	kfree(vector);
 	return NULL;
 }
 
@@ -131,7 +131,7 @@  void dal_vector_destruct(
 	struct vector *vector)
 {
 	if (vector->container != NULL)
-		dm_free(vector->container);
+		kfree(vector->container);
 	vector->count = 0;
 	vector->capacity = 0;
 }
@@ -142,7 +142,7 @@  void dal_vector_destroy(
 	if (vector == NULL || *vector == NULL)
 		return;
 	dal_vector_destruct(*vector);
-	dm_free(*vector);
+	kfree(*vector);
 	*vector = NULL;
 }
 
@@ -290,7 +290,8 @@  bool dal_vector_reserve(struct vector *vector, uint32_t capacity)
 	if (capacity <= vector->capacity)
 		return true;
 
-	new_container = dm_realloc(vector->container, capacity * vector->struct_size);
+	new_container = krealloc(vector->container,
+				 capacity * vector->struct_size, GFP_KERNEL);
 
 	if (new_container) {
 		vector->container = new_container;
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index 2c411441771b..47d673a1f688 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -116,14 +116,14 @@  struct dc_bios *bios_parser_create(
 {
 	struct bios_parser *bp = NULL;
 
-	bp = dm_alloc(sizeof(struct bios_parser));
+	bp = kzalloc(sizeof(struct bios_parser), GFP_KERNEL);
 	if (!bp)
 		return NULL;
 
 	if (bios_parser_construct(bp, init, dce_version))
 		return &bp->base;
 
-	dm_free(bp);
+	kfree(bp);
 	BREAK_TO_DEBUGGER();
 	return NULL;
 }
@@ -131,10 +131,10 @@  struct dc_bios *bios_parser_create(
 static void destruct(struct bios_parser *bp)
 {
 	if (bp->base.bios_local_image)
-		dm_free(bp->base.bios_local_image);
+		kfree(bp->base.bios_local_image);
 
 	if (bp->base.integrated_info)
-		dm_free(bp->base.integrated_info);
+		kfree(bp->base.integrated_info);
 }
 
 static void bios_parser_destroy(struct dc_bios **dcb)
@@ -148,7 +148,7 @@  static void bios_parser_destroy(struct dc_bios **dcb)
 
 	destruct(bp);
 
-	dm_free(bp);
+	kfree(bp);
 	*dcb = NULL;
 }
 
@@ -3531,7 +3531,8 @@  static void process_ext_display_connection_info(struct bios_parser *bp)
 		uint8_t *original_bios;
 		/* Step 1: Replace bios image with the new copy which will be
 		 * patched */
-		bp->base.bios_local_image = dm_alloc(bp->base.bios_size);
+		bp->base.bios_local_image = kzalloc(bp->base.bios_size,
+						    GFP_KERNEL);
 		if (bp->base.bios_local_image == NULL) {
 			BREAK_TO_DEBUGGER();
 			/* Failed to alloc bp->base.bios_local_image */
@@ -3965,7 +3966,7 @@  static struct integrated_info *bios_parser_create_integrated_info(
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
 	struct integrated_info *info = NULL;
 
-	info = dm_alloc(sizeof(struct integrated_info));
+	info = kzalloc(sizeof(struct integrated_info), GFP_KERNEL);
 
 	if (info == NULL) {
 		ASSERT_CRITICAL(0);
@@ -3975,7 +3976,7 @@  static struct integrated_info *bios_parser_create_integrated_info(
 	if (construct_integrated_info(bp, info) == BP_RESULT_OK)
 		return info;
 
-	dm_free(info);
+	kfree(info);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 95fe50f62c57..3f8e605efde9 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -107,10 +107,10 @@  static struct atom_encoder_caps_record *get_encoder_cap_record(
 static void destruct(struct bios_parser *bp)
 {
 	if (bp->base.bios_local_image)
-		dm_free(bp->base.bios_local_image);
+		kfree(bp->base.bios_local_image);
 
 	if (bp->base.integrated_info)
-		dm_free(bp->base.integrated_info);
+		kfree(bp->base.integrated_info);
 }
 
 static void firmware_parser_destroy(struct dc_bios **dcb)
@@ -124,7 +124,7 @@  static void firmware_parser_destroy(struct dc_bios **dcb)
 
 	destruct(bp);
 
-	dm_free(bp);
+	kfree(bp);
 	*dcb = NULL;
 }
 
@@ -2030,7 +2030,7 @@  static struct integrated_info *bios_parser_create_integrated_info(
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
 	struct integrated_info *info = NULL;
 
-	info = dm_alloc(sizeof(struct integrated_info));
+	info = kzalloc(sizeof(struct integrated_info), GFP_KERNEL);
 
 	if (info == NULL) {
 		ASSERT_CRITICAL(0);
@@ -2040,7 +2040,7 @@  static struct integrated_info *bios_parser_create_integrated_info(
 	if (construct_integrated_info(bp, info) == BP_RESULT_OK)
 	return info;
 
-	dm_free(info);
+	kfree(info);
 
 	return NULL;
 }
@@ -2205,14 +2205,14 @@  struct dc_bios *firmware_parser_create(
 {
 	struct bios_parser *bp = NULL;
 
-	bp = dm_alloc(sizeof(struct bios_parser));
+	bp = kzalloc(sizeof(struct bios_parser), GFP_KERNEL);
 	if (!bp)
 		return NULL;
 
 	if (bios_parser_construct(bp, init, dce_version))
 		return &bp->base;
 
-	dm_free(bp);
+	kfree(bp);
 	return NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
index dba25853f7f9..15cbfc400633 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
@@ -2792,7 +2792,8 @@  bool bw_calcs(struct dc_context *ctx,
 	int pipe_count,
 	struct dce_bw_output *calcs_output)
 {
-	struct bw_calcs_data *data = dm_alloc(sizeof(struct bw_calcs_data));
+	struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
+					     GFP_KERNEL);
 
 	populate_initial_data(pipe, pipe_count, data);
 
@@ -3248,7 +3249,7 @@  bool bw_calcs(struct dc_context *ctx,
 		calcs_output->sclk_khz = 0;
 	}
 
-	dm_free(data);
+	kfree(data);
 
 	return is_display_configuration_supported(vbios, calcs_output);
 }
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
index 1b0f64756be6..91f43a1b88ee 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
+++ b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
@@ -481,8 +481,8 @@  static void dcn_dml_wm_override(
 {
 	int i, in_idx, active_count;
 
-	struct _vcs_dpi_display_e2e_pipe_params_st *input = dm_alloc(pool->pipe_count *
-					sizeof(struct _vcs_dpi_display_e2e_pipe_params_st));
+	struct _vcs_dpi_display_e2e_pipe_params_st *input = kzalloc(pool->pipe_count * sizeof(struct _vcs_dpi_display_e2e_pipe_params_st),
+								    GFP_KERNEL);
 	struct wm {
 		double urgent;
 		struct _vcs_dpi_cstate_pstate_watermarks_st cpstate;
@@ -560,7 +560,7 @@  static void dcn_dml_wm_override(
 			pipe->plane_state->flip_immediate);
 		in_idx++;
 	}
-	dm_free(input);
+	kfree(input);
 }
 
 static void split_stream_across_pipes(
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 58c5083bef2a..d86d9796e4cc 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -113,7 +113,7 @@  static bool create_links(
 	}
 
 	for (i = 0; i < num_virtual_links; i++) {
-		struct dc_link *link = dm_alloc(sizeof(*link));
+		struct dc_link *link = kzalloc(sizeof(*link), GFP_KERNEL);
 		struct encoder_init_data enc_init = {0};
 
 		if (link == NULL) {
@@ -127,7 +127,7 @@  static bool create_links(
 		link->link_id.type = OBJECT_TYPE_CONNECTOR;
 		link->link_id.id = CONNECTOR_ID_VIRTUAL;
 		link->link_id.enum_id = ENUM_ID_1;
-		link->link_enc = dm_alloc(sizeof(*link->link_enc));
+		link->link_enc = kzalloc(sizeof(*link->link_enc), GFP_KERNEL);
 
 		enc_init.ctx = dc->ctx;
 		enc_init.channel = CHANNEL_ID_UNKNOWN;
@@ -413,20 +413,20 @@  static void destruct(struct dc *dc)
 	if (dc->ctx->logger)
 		dal_logger_destroy(&dc->ctx->logger);
 
-	dm_free(dc->ctx);
+	kfree(dc->ctx);
 	dc->ctx = NULL;
 
-	dm_free(dc->bw_vbios);
+	kfree(dc->bw_vbios);
 	dc->bw_vbios = NULL;
 
-	dm_free(dc->bw_dceip);
+	kfree(dc->bw_dceip);
 	dc->bw_dceip = NULL;
 
 #ifdef CONFIG_DRM_AMD_DC_DCN1_0
-	dm_free(dc->dcn_soc);
+	kfree(dc->dcn_soc);
 	dc->dcn_soc = NULL;
 
-	dm_free(dc->dcn_ip);
+	kfree(dc->dcn_ip);
 	dc->dcn_ip = NULL;
 
 #endif
@@ -436,12 +436,15 @@  static bool construct(struct dc *dc,
 		const struct dc_init_data *init_params)
 {
 	struct dal_logger *logger;
-	struct dc_context *dc_ctx = dm_alloc(sizeof(*dc_ctx));
-	struct bw_calcs_dceip *dc_dceip = dm_alloc(sizeof(*dc_dceip));
-	struct bw_calcs_vbios *dc_vbios = dm_alloc(sizeof(*dc_vbios));
+	struct dc_context *dc_ctx = kzalloc(sizeof(*dc_ctx), GFP_KERNEL);
+	struct bw_calcs_dceip *dc_dceip = kzalloc(sizeof(*dc_dceip),
+						  GFP_KERNEL);
+	struct bw_calcs_vbios *dc_vbios = kzalloc(sizeof(*dc_vbios),
+						  GFP_KERNEL);
 #ifdef CONFIG_DRM_AMD_DC_DCN1_0
-	struct dcn_soc_bounding_box *dcn_soc = dm_alloc(sizeof(*dcn_soc));
-	struct dcn_ip_params *dcn_ip = dm_alloc(sizeof(*dcn_ip));
+	struct dcn_soc_bounding_box *dcn_soc = kzalloc(sizeof(*dcn_soc),
+						       GFP_KERNEL);
+	struct dcn_ip_params *dcn_ip = kzalloc(sizeof(*dcn_ip), GFP_KERNEL);
 #endif
 
 	enum dce_version dc_version = DCE_VERSION_UNKNOWN;
@@ -604,7 +607,7 @@  void ProgramPixelDurationV(unsigned int pixelClockInKHz )
 
 struct dc *dc_create(const struct dc_init_data *init_params)
  {
-	struct dc *dc = dm_alloc(sizeof(*dc));
+	struct dc *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
 	unsigned int full_pipe_count;
 
 	if (NULL == dc)
@@ -638,7 +641,7 @@  struct dc *dc_create(const struct dc_init_data *init_params)
 	return dc;
 
 construct_fail:
-	dm_free(dc);
+	kfree(dc);
 
 alloc_fail:
 	return NULL;
@@ -647,7 +650,7 @@  struct dc *dc_create(const struct dc_init_data *init_params)
 void dc_destroy(struct dc **dc)
 {
 	destruct(*dc);
-	dm_free(*dc);
+	kfree(*dc);
 	*dc = NULL;
 }
 
@@ -900,7 +903,7 @@  bool dc_commit_planes_to_stream(
 	struct dc_scaling_info scaling_info[MAX_SURFACES];
 	int i;
 	struct dc_stream_update *stream_update =
-			dm_alloc(sizeof(struct dc_stream_update));
+			kzalloc(sizeof(struct dc_stream_update), GFP_KERNEL);
 
 	if (!stream_update) {
 		BREAK_TO_DEBUGGER();
@@ -951,13 +954,14 @@  bool dc_commit_planes_to_stream(
 
 	dc_post_update_surfaces_to_stream(dc);
 
-	dm_free(stream_update);
+	kfree(stream_update);
 	return true;
 }
 
 struct dc_state *dc_create_state(void)
 {
-	struct dc_state *context = dm_alloc(sizeof(struct dc_state));
+	struct dc_state *context = kzalloc(sizeof(struct dc_state),
+					   GFP_KERNEL);
 
 	if (!context)
 		return NULL;
@@ -979,7 +983,7 @@  void dc_release_state(struct dc_state *context)
 
 	if (atomic_read(&context->ref_count) == 0) {
 		dc_resource_state_destruct(context);
-		dm_free(context);
+		kfree(context);
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 845ec421d861..43ebd8941b77 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1100,7 +1100,7 @@  static bool construct(
 struct dc_link *link_create(const struct link_init_data *init_params)
 {
 	struct dc_link *link =
-			dm_alloc(sizeof(*link));
+			kzalloc(sizeof(*link), GFP_KERNEL);
 
 	if (NULL == link)
 		goto alloc_fail;
@@ -1111,7 +1111,7 @@  struct dc_link *link_create(const struct link_init_data *init_params)
 	return link;
 
 construct_fail:
-	dm_free(link);
+	kfree(link);
 
 alloc_fail:
 	return NULL;
@@ -1120,7 +1120,7 @@  struct dc_link *link_create(const struct link_init_data *init_params)
 void link_destroy(struct dc_link **link)
 {
 	destruct(*link);
-	dm_free(*link);
+	kfree(*link);
 	*link = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index d09e539397ea..226512c11ab7 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -130,7 +130,7 @@  struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context *ctx, uint32_
 {
 	struct i2c_payloads *payloads;
 
-	payloads = dm_alloc(sizeof(struct i2c_payloads));
+	payloads = kzalloc(sizeof(struct i2c_payloads), GFP_KERNEL);
 
 	if (!payloads)
 		return NULL;
@@ -139,7 +139,7 @@  struct i2c_payloads *dal_ddc_i2c_payloads_create(struct dc_context *ctx, uint32_
 		&payloads->payloads, ctx, count, sizeof(struct i2c_payload)))
 		return payloads;
 
-	dm_free(payloads);
+	kfree(payloads);
 	return NULL;
 
 }
@@ -159,7 +159,7 @@  void dal_ddc_i2c_payloads_destroy(struct i2c_payloads **p)
 	if (!p || !*p)
 		return;
 	dal_vector_destruct(&(*p)->payloads);
-	dm_free(*p);
+	kfree(*p);
 	*p = NULL;
 
 }
@@ -168,7 +168,7 @@  struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context *ctx, uint32_
 {
 	struct aux_payloads *payloads;
 
-	payloads = dm_alloc(sizeof(struct aux_payloads));
+	payloads = kzalloc(sizeof(struct aux_payloads), GFP_KERNEL);
 
 	if (!payloads)
 		return NULL;
@@ -177,7 +177,7 @@  struct aux_payloads *dal_ddc_aux_payloads_create(struct dc_context *ctx, uint32_
 		&payloads->payloads, ctx, count, sizeof(struct aux_payload)))
 		return payloads;
 
-	dm_free(payloads);
+	kfree(payloads);
 	return NULL;
 }
 
@@ -197,7 +197,7 @@  void dal_ddc_aux_payloads_destroy(struct aux_payloads **p)
 		return;
 
 	dal_vector_destruct(&(*p)->payloads);
-	dm_free(*p);
+	kfree(*p);
 	*p = NULL;
 }
 
@@ -290,7 +290,7 @@  struct ddc_service *dal_ddc_service_create(
 {
 	struct ddc_service *ddc_service;
 
-	ddc_service = dm_alloc(sizeof(struct ddc_service));
+	ddc_service = kzalloc(sizeof(struct ddc_service), GFP_KERNEL);
 
 	if (!ddc_service)
 		return NULL;
@@ -298,7 +298,7 @@  struct ddc_service *dal_ddc_service_create(
 	if (construct(ddc_service, init_data))
 		return ddc_service;
 
-	dm_free(ddc_service);
+	kfree(ddc_service);
 	return NULL;
 }
 
@@ -315,7 +315,7 @@  void dal_ddc_service_destroy(struct ddc_service **ddc)
 		return;
 	}
 	destruct(*ddc);
-	dm_free(*ddc);
+	kfree(*ddc);
 	*ddc = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index dcfdfebd5c62..1832f252edab 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -160,7 +160,7 @@  void dc_destroy_resource_pool(struct dc  *dc)
 			dc->res_pool->funcs->destroy(&dc->res_pool);
 
 		if (dc->hwseq)
-			dm_free(dc->hwseq);
+			kfree(dc->hwseq);
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_sink.c b/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
index 7717350297a5..b3bbafc8fd6a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
@@ -34,7 +34,7 @@ 
 static void destruct(struct dc_sink *sink)
 {
 	if (sink->dc_container_id) {
-		dm_free(sink->dc_container_id);
+		kfree(sink->dc_container_id);
 		sink->dc_container_id = NULL;
 	}
 }
@@ -74,13 +74,13 @@  void dc_sink_release(struct dc_sink *sink)
 
 	if (atomic_read(&sink->ref_count) == 0) {
 		destruct(sink);
-		dm_free(sink);
+		kfree(sink);
 	}
 }
 
 struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 {
-	struct dc_sink *sink = dm_alloc(sizeof(*sink));
+	struct dc_sink *sink = kzalloc(sizeof(*sink), GFP_KERNEL);
 
 	if (NULL == sink)
 		goto alloc_fail;
@@ -93,7 +93,7 @@  struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
 	return sink;
 
 construct_fail:
-	dm_free(sink);
+	kfree(sink);
 
 alloc_fail:
 	return NULL;
@@ -117,7 +117,8 @@  bool dc_sink_set_container_id(struct dc_sink *dc_sink, const struct dc_container
 {
 	if (dc_sink && container_id) {
 		if (!dc_sink->dc_container_id)
-			dc_sink->dc_container_id = dm_alloc(sizeof(*dc_sink->dc_container_id));
+			dc_sink->dc_container_id = kzalloc(sizeof(*dc_sink->dc_container_id),
+							   GFP_KERNEL);
 
 		if (dc_sink->dc_container_id) {
 			memmove(&dc_sink->dc_container_id->guid, &container_id->guid,
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index a421779093d9..d5da847ffad6 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -131,7 +131,7 @@  void dc_stream_release(struct dc_stream_state *stream)
 
 		if (atomic_read(&stream->ref_count) == 0) {
 			destruct(stream);
-			dm_free(stream);
+			kfree(stream);
 		}
 	}
 }
@@ -144,7 +144,7 @@  struct dc_stream_state *dc_create_stream_for_sink(
 	if (sink == NULL)
 		goto alloc_fail;
 
-	stream = dm_alloc(sizeof(struct dc_stream_state));
+	stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL);
 
 	if (NULL == stream)
 		goto alloc_fail;
@@ -157,7 +157,7 @@  struct dc_stream_state *dc_create_stream_for_sink(
 	return stream;
 
 construct_fail:
-	dm_free(stream);
+	kfree(stream);
 
 alloc_fail:
 	return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index e96f63eed070..511ada94530e 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -68,7 +68,8 @@  struct dc_plane_state *dc_create_plane_state(struct dc *dc)
 {
 	struct dc *core_dc = dc;
 
-	struct dc_plane_state *plane_state = dm_alloc(sizeof(*plane_state));
+	struct dc_plane_state *plane_state = kzalloc(sizeof(*plane_state),
+						     GFP_KERNEL);
 
 	if (NULL == plane_state)
 		goto alloc_fail;
@@ -81,7 +82,7 @@  struct dc_plane_state *dc_create_plane_state(struct dc *dc)
 	return plane_state;
 
 construct_fail:
-	dm_free(plane_state);
+	kfree(plane_state);
 
 alloc_fail:
 	return NULL;
@@ -133,7 +134,7 @@  void dc_plane_state_release(struct dc_plane_state *plane_state)
 
 	if (atomic_read(&plane_state->ref_count) == 0) {
 		destruct(plane_state);
-		dm_free(plane_state);
+		kfree(plane_state);
 	}
 }
 
@@ -149,14 +150,14 @@  void dc_gamma_release(struct dc_gamma **gamma)
 	atomic_dec(&(*gamma)->ref_count);
 
 	if (atomic_read(&(*gamma)->ref_count) == 0)
-		dm_free((*gamma));
+		kfree((*gamma));
 
 	*gamma = NULL;
 }
 
 struct dc_gamma *dc_create_gamma()
 {
-	struct dc_gamma *gamma = dm_alloc(sizeof(*gamma));
+	struct dc_gamma *gamma = kzalloc(sizeof(*gamma), GFP_KERNEL);
 
 	if (gamma == NULL)
 		goto alloc_fail;
@@ -181,12 +182,12 @@  void dc_transfer_func_release(struct dc_transfer_func *tf)
 	atomic_dec(&tf->ref_count);
 
 	if (atomic_read(&tf->ref_count) == 0)
-		dm_free(tf);
+		kfree(tf);
 }
 
 struct dc_transfer_func *dc_create_transfer_func()
 {
-	struct dc_transfer_func *tf = dm_alloc(sizeof(*tf));
+	struct dc_transfer_func *tf = kzalloc(sizeof(*tf), GFP_KERNEL);
 
 	if (tf == NULL)
 		goto alloc_fail;
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
index 0e9d914e1a8f..0e0336c5af4e 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
@@ -462,7 +462,7 @@  struct abm *dce_abm_create(
 	const struct dce_abm_shift *abm_shift,
 	const struct dce_abm_mask *abm_mask)
 {
-	struct dce_abm *abm_dce = dm_alloc(sizeof(*abm_dce));
+	struct dce_abm *abm_dce = kzalloc(sizeof(*abm_dce), GFP_KERNEL);
 
 	if (abm_dce == NULL) {
 		BREAK_TO_DEBUGGER();
@@ -480,6 +480,6 @@  void dce_abm_destroy(struct abm **abm)
 {
 	struct dce_abm *abm_dce = TO_DCE_ABM(*abm);
 
-	dm_free(abm_dce);
+	kfree(abm_dce);
 	*abm = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
index b94c1e5d85cb..198f4532e100 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
@@ -897,7 +897,7 @@  void dce_aud_destroy(struct audio **audio)
 {
 	struct dce_audio *aud = DCE_AUD(*audio);
 
-	dm_free(aud);
+	kfree(aud);
 	*audio = NULL;
 }
 
@@ -909,7 +909,7 @@  struct audio *dce_audio_create(
 		const struct dce_aduio_mask *masks
 		)
 {
-	struct dce_audio *audio = dm_alloc(sizeof(*audio));
+	struct dce_audio *audio = kzalloc(sizeof(*audio), GFP_KERNEL);
 
 	if (audio == NULL) {
 		ASSERT_CRITICAL(audio);
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
index d3b61b92ebec..31280d252753 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
@@ -1084,12 +1084,14 @@  static void get_ss_info_from_atombios(
 	if (*ss_entries_num == 0)
 		return;
 
-	ss_info = dm_alloc(sizeof(struct spread_spectrum_info) * (*ss_entries_num));
+	ss_info = kzalloc(sizeof(struct spread_spectrum_info) * (*ss_entries_num),
+			  GFP_KERNEL);
 	ss_info_cur = ss_info;
 	if (ss_info == NULL)
 		return;
 
-	ss_data = dm_alloc(sizeof(struct spread_spectrum_data) * (*ss_entries_num));
+	ss_data = kzalloc(sizeof(struct spread_spectrum_data) * (*ss_entries_num),
+			  GFP_KERNEL);
 	if (ss_data == NULL)
 		goto out_free_info;
 
@@ -1157,14 +1159,14 @@  static void get_ss_info_from_atombios(
 	}
 
 	*spread_spectrum_data = ss_data;
-	dm_free(ss_info);
+	kfree(ss_info);
 	return;
 
 out_free_data:
-	dm_free(ss_data);
+	kfree(ss_data);
 	*ss_entries_num = 0;
 out_free_info:
-	dm_free(ss_info);
+	kfree(ss_info);
 }
 
 static void ss_info_from_atombios_create(
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
index 06d9a3e7c8a2..3e9ff2f5472d 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
@@ -719,7 +719,7 @@  struct display_clock *dce_disp_clk_create(
 	const struct dce_disp_clk_shift *clk_shift,
 	const struct dce_disp_clk_mask *clk_mask)
 {
-	struct dce_disp_clk *clk_dce = dm_alloc(sizeof(*clk_dce));
+	struct dce_disp_clk *clk_dce = kzalloc(sizeof(*clk_dce), GFP_KERNEL);
 
 	if (clk_dce == NULL) {
 		BREAK_TO_DEBUGGER();
@@ -742,7 +742,7 @@  struct display_clock *dce110_disp_clk_create(
 	const struct dce_disp_clk_shift *clk_shift,
 	const struct dce_disp_clk_mask *clk_mask)
 {
-	struct dce_disp_clk *clk_dce = dm_alloc(sizeof(*clk_dce));
+	struct dce_disp_clk *clk_dce = kzalloc(sizeof(*clk_dce), GFP_KERNEL);
 
 	if (clk_dce == NULL) {
 		BREAK_TO_DEBUGGER();
@@ -767,7 +767,7 @@  struct display_clock *dce112_disp_clk_create(
 	const struct dce_disp_clk_shift *clk_shift,
 	const struct dce_disp_clk_mask *clk_mask)
 {
-	struct dce_disp_clk *clk_dce = dm_alloc(sizeof(*clk_dce));
+	struct dce_disp_clk *clk_dce = kzalloc(sizeof(*clk_dce), GFP_KERNEL);
 
 	if (clk_dce == NULL) {
 		BREAK_TO_DEBUGGER();
@@ -788,7 +788,7 @@  struct display_clock *dce112_disp_clk_create(
 
 struct display_clock *dce120_disp_clk_create(struct dc_context *ctx)
 {
-	struct dce_disp_clk *clk_dce = dm_alloc(sizeof(*clk_dce));
+	struct dce_disp_clk *clk_dce = kzalloc(sizeof(*clk_dce), GFP_KERNEL);
 	struct dm_pp_clock_levels_with_voltage clk_level_info = {0};
 
 	if (clk_dce == NULL) {
@@ -822,6 +822,6 @@  void dce_disp_clk_destroy(struct display_clock **disp_clk)
 {
 	struct dce_disp_clk *clk_dce = TO_DCE_CLOCKS(*disp_clk);
 
-	dm_free(clk_dce);
+	kfree(clk_dce);
 	*disp_clk = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c b/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c
index 313f61bf06e1..f9873cad40e0 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c
@@ -573,7 +573,7 @@  struct dmcu *dce_dmcu_create(
 	const struct dce_dmcu_shift *dmcu_shift,
 	const struct dce_dmcu_mask *dmcu_mask)
 {
-	struct dce_dmcu *dmcu_dce = dm_alloc(sizeof(*dmcu_dce));
+	struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
 
 	if (dmcu_dce == NULL) {
 		BREAK_TO_DEBUGGER();
@@ -595,7 +595,7 @@  struct dmcu *dcn10_dmcu_create(
 	const struct dce_dmcu_shift *dmcu_shift,
 	const struct dce_dmcu_mask *dmcu_mask)
 {
-	struct dce_dmcu *dmcu_dce = dm_alloc(sizeof(*dmcu_dce));
+	struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL);
 
 	if (dmcu_dce == NULL) {
 		BREAK_TO_DEBUGGER();
@@ -615,6 +615,6 @@  void dce_dmcu_destroy(struct dmcu **dmcu)
 {
 	struct dce_dmcu *dmcu_dce = TO_DCE_DMCU(*dmcu);
 
-	dm_free(dmcu_dce);
+	kfree(dmcu_dce);
 	*dmcu = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c b/drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c
index e010cf10d605..fa481d481132 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c
@@ -261,6 +261,6 @@  void dce_ipp_construct(
 
 void dce_ipp_destroy(struct input_pixel_processor **ipp)
 {
-	dm_free(TO_DCE_IPP(*ipp));
+	kfree(TO_DCE_IPP(*ipp));
 	*ipp = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
index 0ce94ede80bf..2ce730de0dc3 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c
@@ -1108,7 +1108,7 @@  void dce110_link_encoder_hw_init(
 
 void dce110_link_encoder_destroy(struct link_encoder **enc)
 {
-	dm_free(TO_DCE110_LINK_ENC(*enc));
+	kfree(TO_DCE110_LINK_ENC(*enc));
 	*enc = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c b/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
index 348e4b7047f1..c0736aeabd85 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_opp.c
@@ -563,7 +563,7 @@  bool dce110_opp_construct(struct dce110_opp *opp110,
 void dce110_opp_destroy(struct output_pixel_processor **opp)
 {
 	if (*opp)
-		dm_free(FROM_DCE11_OPP(*opp));
+		kfree(FROM_DCE11_OPP(*opp));
 	*opp = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
index ca6c7c2a1b4c..9a75bde32611 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -370,7 +370,7 @@  static struct timing_generator *dce100_timing_generator_create(
 		const struct dce110_timing_generator_offsets *offsets)
 {
 	struct dce110_timing_generator *tg110 =
-		dm_alloc(sizeof(struct dce110_timing_generator));
+		kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL);
 
 	if (!tg110)
 		return NULL;
@@ -380,7 +380,7 @@  static struct timing_generator *dce100_timing_generator_create(
 		return &tg110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(tg110);
+	kfree(tg110);
 	return NULL;
 }
 
@@ -389,7 +389,7 @@  static struct stream_encoder *dce100_stream_encoder_create(
 	struct dc_context *ctx)
 {
 	struct dce110_stream_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_stream_encoder));
+		kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -400,7 +400,7 @@  static struct stream_encoder *dce100_stream_encoder_create(
 		return &enc110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -422,7 +422,7 @@  static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dce100_hwseq_create(
 	struct dc_context *ctx)
 {
-	struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+	struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
 	if (hws) {
 		hws->ctx = ctx;
@@ -467,7 +467,8 @@  static struct mem_input *dce100_mem_input_create(
 	struct dc_context *ctx,
 	uint32_t inst)
 {
-	struct dce_mem_input *dce_mi = dm_alloc(sizeof(struct dce_mem_input));
+	struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input),
+					       GFP_KERNEL);
 
 	if (!dce_mi) {
 		BREAK_TO_DEBUGGER();
@@ -481,7 +482,7 @@  static struct mem_input *dce100_mem_input_create(
 
 static void dce100_transform_destroy(struct transform **xfm)
 {
-	dm_free(TO_DCE_TRANSFORM(*xfm));
+	kfree(TO_DCE_TRANSFORM(*xfm));
 	*xfm = NULL;
 }
 
@@ -490,7 +491,7 @@  static struct transform *dce100_transform_create(
 	uint32_t inst)
 {
 	struct dce_transform *transform =
-		dm_alloc(sizeof(struct dce_transform));
+		kzalloc(sizeof(struct dce_transform), GFP_KERNEL);
 
 	if (!transform)
 		return NULL;
@@ -501,14 +502,14 @@  static struct transform *dce100_transform_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(transform);
+	kfree(transform);
 	return NULL;
 }
 
 static struct input_pixel_processor *dce100_ipp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
-	struct dce_ipp *ipp = dm_alloc(sizeof(struct dce_ipp));
+	struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
 
 	if (!ipp) {
 		BREAK_TO_DEBUGGER();
@@ -532,7 +533,7 @@  struct link_encoder *dce100_link_encoder_create(
 	const struct encoder_init_data *enc_init_data)
 {
 	struct dce110_link_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_link_encoder));
+		kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -549,7 +550,7 @@  struct link_encoder *dce100_link_encoder_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -558,7 +559,7 @@  struct output_pixel_processor *dce100_opp_create(
 	uint32_t inst)
 {
 	struct dce110_opp *opp =
-		dm_alloc(sizeof(struct dce110_opp));
+		kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
 
 	if (!opp)
 		return NULL;
@@ -568,7 +569,7 @@  struct output_pixel_processor *dce100_opp_create(
 		return &opp->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(opp);
+	kfree(opp);
 	return NULL;
 }
 
@@ -580,7 +581,7 @@  struct clock_source *dce100_clock_source_create(
 	bool dp_clk_src)
 {
 	struct dce110_clk_src *clk_src =
-		dm_alloc(sizeof(struct dce110_clk_src));
+		kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
 	if (!clk_src)
 		return NULL;
@@ -597,7 +598,7 @@  struct clock_source *dce100_clock_source_create(
 
 void dce100_clock_source_destroy(struct clock_source **clk_src)
 {
-	dm_free(TO_DCE110_CLK_SRC(*clk_src));
+	kfree(TO_DCE110_CLK_SRC(*clk_src));
 	*clk_src = NULL;
 }
 
@@ -616,19 +617,19 @@  static void destruct(struct dce110_resource_pool *pool)
 			dce_ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
-			dm_free(TO_DCE_MEM_INPUT(pool->base.mis[i]));
+			kfree(TO_DCE_MEM_INPUT(pool->base.mis[i]));
 			pool->base.mis[i] = NULL;
 		}
 
 		if (pool->base.timing_generators[i] != NULL)	{
-			dm_free(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
+			kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
 			pool->base.timing_generators[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < pool->base.stream_enc_count; i++) {
 		if (pool->base.stream_enc[i] != NULL)
-			dm_free(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
+			kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
 	}
 
 	for (i = 0; i < pool->base.clk_src_count; i++) {
@@ -768,7 +769,7 @@  static void dce100_destroy_resource_pool(struct resource_pool **pool)
 	struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
 
 	destruct(dce110_pool);
-	dm_free(dce110_pool);
+	kfree(dce110_pool);
 	*pool = NULL;
 }
 
@@ -950,7 +951,7 @@  struct resource_pool *dce100_create_resource_pool(
 	struct dc  *dc)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c
index f82c26995609..90770cb2ffcd 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c
@@ -388,7 +388,7 @@  void dce110_compressor_set_fbc_invalidation_triggers(
 struct compressor *dce110_compressor_create(struct dc_context *ctx)
 {
 	struct dce110_compressor *cp110 =
-		dm_alloc(sizeof(struct dce110_compressor));
+		kzalloc(sizeof(struct dce110_compressor), GFP_KERNEL);
 
 	if (!cp110)
 		return NULL;
@@ -397,13 +397,13 @@  struct compressor *dce110_compressor_create(struct dc_context *ctx)
 		return &cp110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(cp110);
+	kfree(cp110);
 	return NULL;
 }
 
 void dce110_compressor_destroy(struct compressor **compressor)
 {
-	dm_free(TO_DCE110_COMPRESSOR(*compressor));
+	kfree(TO_DCE110_COMPRESSOR(*compressor));
 	*compressor = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
index 25eda52c32ef..787e20e15221 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
@@ -405,7 +405,7 @@  static struct timing_generator *dce110_timing_generator_create(
 		const struct dce110_timing_generator_offsets *offsets)
 {
 	struct dce110_timing_generator *tg110 =
-		dm_alloc(sizeof(struct dce110_timing_generator));
+		kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL);
 
 	if (!tg110)
 		return NULL;
@@ -414,7 +414,7 @@  static struct timing_generator *dce110_timing_generator_create(
 		return &tg110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(tg110);
+	kfree(tg110);
 	return NULL;
 }
 
@@ -423,7 +423,7 @@  static struct stream_encoder *dce110_stream_encoder_create(
 	struct dc_context *ctx)
 {
 	struct dce110_stream_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_stream_encoder));
+		kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -434,7 +434,7 @@  static struct stream_encoder *dce110_stream_encoder_create(
 		return &enc110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -460,7 +460,7 @@  static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dce110_hwseq_create(
 	struct dc_context *ctx)
 {
-	struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+	struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
 	if (hws) {
 		hws->ctx = ctx;
@@ -505,7 +505,8 @@  static struct mem_input *dce110_mem_input_create(
 	struct dc_context *ctx,
 	uint32_t inst)
 {
-	struct dce_mem_input *dce_mi = dm_alloc(sizeof(struct dce_mem_input));
+	struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input),
+					       GFP_KERNEL);
 
 	if (!dce_mi) {
 		BREAK_TO_DEBUGGER();
@@ -519,7 +520,7 @@  static struct mem_input *dce110_mem_input_create(
 
 static void dce110_transform_destroy(struct transform **xfm)
 {
-	dm_free(TO_DCE_TRANSFORM(*xfm));
+	kfree(TO_DCE_TRANSFORM(*xfm));
 	*xfm = NULL;
 }
 
@@ -528,7 +529,7 @@  static struct transform *dce110_transform_create(
 	uint32_t inst)
 {
 	struct dce_transform *transform =
-		dm_alloc(sizeof(struct dce_transform));
+		kzalloc(sizeof(struct dce_transform), GFP_KERNEL);
 
 	if (!transform)
 		return NULL;
@@ -538,14 +539,14 @@  static struct transform *dce110_transform_create(
 		return &transform->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(transform);
+	kfree(transform);
 	return NULL;
 }
 
 static struct input_pixel_processor *dce110_ipp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
-	struct dce_ipp *ipp = dm_alloc(sizeof(struct dce_ipp));
+	struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
 
 	if (!ipp) {
 		BREAK_TO_DEBUGGER();
@@ -569,7 +570,7 @@  static struct link_encoder *dce110_link_encoder_create(
 	const struct encoder_init_data *enc_init_data)
 {
 	struct dce110_link_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_link_encoder));
+		kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -586,7 +587,7 @@  static struct link_encoder *dce110_link_encoder_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -595,7 +596,7 @@  static struct output_pixel_processor *dce110_opp_create(
 	uint32_t inst)
 {
 	struct dce110_opp *opp =
-		dm_alloc(sizeof(struct dce110_opp));
+		kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
 
 	if (!opp)
 		return NULL;
@@ -605,7 +606,7 @@  static struct output_pixel_processor *dce110_opp_create(
 		return &opp->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(opp);
+	kfree(opp);
 	return NULL;
 }
 
@@ -617,7 +618,7 @@  struct clock_source *dce110_clock_source_create(
 	bool dp_clk_src)
 {
 	struct dce110_clk_src *clk_src =
-		dm_alloc(sizeof(struct dce110_clk_src));
+		kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
 	if (!clk_src)
 		return NULL;
@@ -642,15 +643,15 @@  void dce110_clock_source_destroy(struct clock_source **clk_src)
 	dce110_clk_src = TO_DCE110_CLK_SRC(*clk_src);
 
 	if (dce110_clk_src->dp_ss_params)
-		dm_free(dce110_clk_src->dp_ss_params);
+		kfree(dce110_clk_src->dp_ss_params);
 
 	if (dce110_clk_src->hdmi_ss_params)
-		dm_free(dce110_clk_src->hdmi_ss_params);
+		kfree(dce110_clk_src->hdmi_ss_params);
 
 	if (dce110_clk_src->dvi_ss_params)
-		dm_free(dce110_clk_src->dvi_ss_params);
+		kfree(dce110_clk_src->dvi_ss_params);
 
-	dm_free(dce110_clk_src);
+	kfree(dce110_clk_src);
 	*clk_src = NULL;
 }
 
@@ -669,19 +670,19 @@  static void destruct(struct dce110_resource_pool *pool)
 			dce_ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
-			dm_free(TO_DCE_MEM_INPUT(pool->base.mis[i]));
+			kfree(TO_DCE_MEM_INPUT(pool->base.mis[i]));
 			pool->base.mis[i] = NULL;
 		}
 
 		if (pool->base.timing_generators[i] != NULL)	{
-			dm_free(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
+			kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
 			pool->base.timing_generators[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < pool->base.stream_enc_count; i++) {
 		if (pool->base.stream_enc[i] != NULL)
-			dm_free(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
+			kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
 	}
 
 	for (i = 0; i < pool->base.clk_src_count; i++) {
@@ -1031,7 +1032,7 @@  static void dce110_destroy_resource_pool(struct resource_pool **pool)
 	struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
 
 	destruct(dce110_pool);
-	dm_free(dce110_pool);
+	kfree(dce110_pool);
 	*pool = NULL;
 }
 
@@ -1048,10 +1049,14 @@  static const struct resource_funcs dce110_res_pool_funcs = {
 
 static bool underlay_create(struct dc_context *ctx, struct resource_pool *pool)
 {
-	struct dce110_timing_generator *dce110_tgv = dm_alloc(sizeof (*dce110_tgv));
-	struct dce_transform *dce110_xfmv = dm_alloc(sizeof (*dce110_xfmv));
-	struct dce_mem_input *dce110_miv = dm_alloc(sizeof (*dce110_miv));
-	struct dce110_opp *dce110_oppv = dm_alloc(sizeof (*dce110_oppv));
+	struct dce110_timing_generator *dce110_tgv = kzalloc(sizeof(*dce110_tgv),
+							     GFP_KERNEL);
+	struct dce_transform *dce110_xfmv = kzalloc(sizeof(*dce110_xfmv),
+						    GFP_KERNEL);
+	struct dce_mem_input *dce110_miv = kzalloc(sizeof(*dce110_miv),
+						   GFP_KERNEL);
+	struct dce110_opp *dce110_oppv = kzalloc(sizeof(*dce110_oppv),
+						 GFP_KERNEL);
 
 	if ((dce110_tgv == NULL) ||
 		(dce110_xfmv == NULL) ||
@@ -1332,7 +1337,7 @@  struct resource_pool *dce110_create_resource_pool(
 	struct hw_asic_id asic_id)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c
index 75af2125344b..e75895baa132 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c
@@ -839,7 +839,7 @@  bool dce112_compressor_construct(struct dce112_compressor *compressor,
 struct compressor *dce112_compressor_create(struct dc_context *ctx)
 {
 	struct dce112_compressor *cp110 =
-		dm_alloc(sizeof(struct dce112_compressor));
+		kzalloc(sizeof(struct dce112_compressor), GFP_KERNEL);
 
 	if (!cp110)
 		return NULL;
@@ -848,12 +848,12 @@  struct compressor *dce112_compressor_create(struct dc_context *ctx)
 		return &cp110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(cp110);
+	kfree(cp110);
 	return NULL;
 }
 
 void dce112_compressor_destroy(struct compressor **compressor)
 {
-	dm_free(TO_DCE112_COMPRESSOR(*compressor));
+	kfree(TO_DCE112_COMPRESSOR(*compressor));
 	*compressor = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index de6f71d8a89b..4e2ed3429a90 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -410,7 +410,7 @@  static struct timing_generator *dce112_timing_generator_create(
 		const struct dce110_timing_generator_offsets *offsets)
 {
 	struct dce110_timing_generator *tg110 =
-		dm_alloc(sizeof(struct dce110_timing_generator));
+		kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL);
 
 	if (!tg110)
 		return NULL;
@@ -419,7 +419,7 @@  static struct timing_generator *dce112_timing_generator_create(
 		return &tg110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(tg110);
+	kfree(tg110);
 	return NULL;
 }
 
@@ -428,7 +428,7 @@  static struct stream_encoder *dce112_stream_encoder_create(
 	struct dc_context *ctx)
 {
 	struct dce110_stream_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_stream_encoder));
+		kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -439,7 +439,7 @@  static struct stream_encoder *dce112_stream_encoder_create(
 		return &enc110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -461,7 +461,7 @@  static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dce112_hwseq_create(
 	struct dc_context *ctx)
 {
-	struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+	struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
 	if (hws) {
 		hws->ctx = ctx;
@@ -501,7 +501,8 @@  static struct mem_input *dce112_mem_input_create(
 	struct dc_context *ctx,
 	uint32_t inst)
 {
-	struct dce_mem_input *dce_mi = dm_alloc(sizeof(struct dce_mem_input));
+	struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input),
+					       GFP_KERNEL);
 
 	if (!dce_mi) {
 		BREAK_TO_DEBUGGER();
@@ -514,7 +515,7 @@  static struct mem_input *dce112_mem_input_create(
 
 static void dce112_transform_destroy(struct transform **xfm)
 {
-	dm_free(TO_DCE_TRANSFORM(*xfm));
+	kfree(TO_DCE_TRANSFORM(*xfm));
 	*xfm = NULL;
 }
 
@@ -523,7 +524,7 @@  static struct transform *dce112_transform_create(
 	uint32_t inst)
 {
 	struct dce_transform *transform =
-		dm_alloc(sizeof(struct dce_transform));
+		kzalloc(sizeof(struct dce_transform), GFP_KERNEL);
 
 	if (!transform)
 		return NULL;
@@ -535,7 +536,7 @@  static struct transform *dce112_transform_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(transform);
+	kfree(transform);
 	return NULL;
 }
 
@@ -554,7 +555,7 @@  struct link_encoder *dce112_link_encoder_create(
 	const struct encoder_init_data *enc_init_data)
 {
 	struct dce110_link_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_link_encoder));
+		kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -571,14 +572,14 @@  struct link_encoder *dce112_link_encoder_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
 static struct input_pixel_processor *dce112_ipp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
-	struct dce_ipp *ipp = dm_alloc(sizeof(struct dce_ipp));
+	struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
 
 	if (!ipp) {
 		BREAK_TO_DEBUGGER();
@@ -595,7 +596,7 @@  struct output_pixel_processor *dce112_opp_create(
 	uint32_t inst)
 {
 	struct dce110_opp *opp =
-		dm_alloc(sizeof(struct dce110_opp));
+		kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
 
 	if (!opp)
 		return NULL;
@@ -605,7 +606,7 @@  struct output_pixel_processor *dce112_opp_create(
 		return &opp->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(opp);
+	kfree(opp);
 	return NULL;
 }
 
@@ -617,7 +618,7 @@  struct clock_source *dce112_clock_source_create(
 	bool dp_clk_src)
 {
 	struct dce110_clk_src *clk_src =
-		dm_alloc(sizeof(struct dce110_clk_src));
+		kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
 	if (!clk_src)
 		return NULL;
@@ -634,7 +635,7 @@  struct clock_source *dce112_clock_source_create(
 
 void dce112_clock_source_destroy(struct clock_source **clk_src)
 {
-	dm_free(TO_DCE110_CLK_SRC(*clk_src));
+	kfree(TO_DCE110_CLK_SRC(*clk_src));
 	*clk_src = NULL;
 }
 
@@ -653,19 +654,19 @@  static void destruct(struct dce110_resource_pool *pool)
 			dce_ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
-			dm_free(TO_DCE_MEM_INPUT(pool->base.mis[i]));
+			kfree(TO_DCE_MEM_INPUT(pool->base.mis[i]));
 			pool->base.mis[i] = NULL;
 		}
 
 		if (pool->base.timing_generators[i] != NULL) {
-			dm_free(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
+			kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
 			pool->base.timing_generators[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < pool->base.stream_enc_count; i++) {
 		if (pool->base.stream_enc[i] != NULL)
-			dm_free(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
+			kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
 	}
 
 	for (i = 0; i < pool->base.clk_src_count; i++) {
@@ -940,7 +941,7 @@  static void dce112_destroy_resource_pool(struct resource_pool **pool)
 	struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
 
 	destruct(dce110_pool);
-	dm_free(dce110_pool);
+	kfree(dce110_pool);
 	*pool = NULL;
 }
 
@@ -1298,7 +1299,7 @@  struct resource_pool *dce112_create_resource_pool(
 	struct dc *dc)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
index e5d2d98982f7..6b5d5948ddb7 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
@@ -351,7 +351,7 @@  struct output_pixel_processor *dce120_opp_create(
 	uint32_t inst)
 {
 	struct dce110_opp *opp =
-		dm_alloc(sizeof(struct dce110_opp));
+		kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
 
 	if (!opp)
 		return NULL;
@@ -361,7 +361,7 @@  struct output_pixel_processor *dce120_opp_create(
 		return &opp->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(opp);
+	kfree(opp);
 	return NULL;
 }
 
@@ -388,7 +388,7 @@  struct clock_source *dce120_clock_source_create(
 	bool dp_clk_src)
 {
 	struct dce110_clk_src *clk_src =
-		dm_alloc(sizeof(*clk_src));
+		kzalloc(sizeof(*clk_src), GFP_KERNEL);
 
 	if (!clk_src)
 		return NULL;
@@ -405,7 +405,7 @@  struct clock_source *dce120_clock_source_create(
 
 void dce120_clock_source_destroy(struct clock_source **clk_src)
 {
-	dm_free(TO_DCE110_CLK_SRC(*clk_src));
+	kfree(TO_DCE110_CLK_SRC(*clk_src));
 	*clk_src = NULL;
 }
 
@@ -428,7 +428,7 @@  static struct timing_generator *dce120_timing_generator_create(
 		const struct dce110_timing_generator_offsets *offsets)
 {
 	struct dce110_timing_generator *tg110 =
-		dm_alloc(sizeof(struct dce110_timing_generator));
+		kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL);
 
 	if (!tg110)
 		return NULL;
@@ -437,13 +437,13 @@  static struct timing_generator *dce120_timing_generator_create(
 		return &tg110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(tg110);
+	kfree(tg110);
 	return NULL;
 }
 
 static void dce120_transform_destroy(struct transform **xfm)
 {
-	dm_free(TO_DCE_TRANSFORM(*xfm));
+	kfree(TO_DCE_TRANSFORM(*xfm));
 	*xfm = NULL;
 }
 
@@ -462,7 +462,7 @@  static void destruct(struct dce110_resource_pool *pool)
 			dce_ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
-			dm_free(TO_DCE_MEM_INPUT(pool->base.mis[i]));
+			kfree(TO_DCE_MEM_INPUT(pool->base.mis[i]));
 			pool->base.mis[i] = NULL;
 		}
 
@@ -471,7 +471,7 @@  static void destruct(struct dce110_resource_pool *pool)
 		}
 
 		if (pool->base.timing_generators[i] != NULL) {
-			dm_free(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
+			kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
 			pool->base.timing_generators[i] = NULL;
 		}
 	}
@@ -483,7 +483,7 @@  static void destruct(struct dce110_resource_pool *pool)
 
 	for (i = 0; i < pool->base.stream_enc_count; i++) {
 		if (pool->base.stream_enc[i] != NULL)
-			dm_free(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
+			kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
 	}
 
 	for (i = 0; i < pool->base.clk_src_count; i++) {
@@ -539,7 +539,7 @@  static struct link_encoder *dce120_link_encoder_create(
 	const struct encoder_init_data *enc_init_data)
 {
 	struct dce110_link_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_link_encoder));
+		kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -556,14 +556,14 @@  static struct link_encoder *dce120_link_encoder_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
 static struct input_pixel_processor *dce120_ipp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
-	struct dce_ipp *ipp = dm_alloc(sizeof(struct dce_ipp));
+	struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
 
 	if (!ipp) {
 		BREAK_TO_DEBUGGER();
@@ -580,7 +580,7 @@  static struct stream_encoder *dce120_stream_encoder_create(
 	struct dc_context *ctx)
 {
 	struct dce110_stream_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_stream_encoder));
+		kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -591,7 +591,7 @@  static struct stream_encoder *dce120_stream_encoder_create(
 		return &enc110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -614,7 +614,7 @@  static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dce120_hwseq_create(
 	struct dc_context *ctx)
 {
-	struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+	struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
 	if (hws) {
 		hws->ctx = ctx;
@@ -654,7 +654,8 @@  static struct mem_input *dce120_mem_input_create(
 	struct dc_context *ctx,
 	uint32_t inst)
 {
-	struct dce_mem_input *dce_mi = dm_alloc(sizeof(struct dce_mem_input));
+	struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input),
+					       GFP_KERNEL);
 
 	if (!dce_mi) {
 		BREAK_TO_DEBUGGER();
@@ -670,7 +671,7 @@  static struct transform *dce120_transform_create(
 	uint32_t inst)
 {
 	struct dce_transform *transform =
-		dm_alloc(sizeof(struct dce_transform));
+		kzalloc(sizeof(struct dce_transform), GFP_KERNEL);
 
 	if (!transform)
 		return NULL;
@@ -682,7 +683,7 @@  static struct transform *dce120_transform_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(transform);
+	kfree(transform);
 	return NULL;
 }
 
@@ -691,7 +692,7 @@  static void dce120_destroy_resource_pool(struct resource_pool **pool)
 	struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
 
 	destruct(dce110_pool);
-	dm_free(dce110_pool);
+	kfree(dce110_pool);
 	*pool = NULL;
 }
 
@@ -1006,7 +1007,7 @@  struct resource_pool *dce120_create_resource_pool(
 	struct dc *dc)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c
index 77626d7624c6..cc1c0d390945 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c
@@ -819,7 +819,7 @@  bool dce80_compressor_construct(struct dce80_compressor *compressor,
 struct compressor *dce80_compressor_create(struct dc_context *ctx)
 {
 	struct dce80_compressor *cp80 =
-		dm_alloc(sizeof(struct dce80_compressor));
+		kzalloc(sizeof(struct dce80_compressor), GFP_KERNEL);
 
 	if (!cp80)
 		return NULL;
@@ -828,12 +828,12 @@  struct compressor *dce80_compressor_create(struct dc_context *ctx)
 		return &cp80->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(cp80);
+	kfree(cp80);
 	return NULL;
 }
 
 void dce80_compressor_destroy(struct compressor **compressor)
 {
-	dm_free(TO_DCE80_COMPRESSOR(*compressor));
+	kfree(TO_DCE80_COMPRESSOR(*compressor));
 	*compressor = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index 5453f02ea8ca..170509a4a221 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -399,7 +399,7 @@  static struct timing_generator *dce80_timing_generator_create(
 		const struct dce110_timing_generator_offsets *offsets)
 {
 	struct dce110_timing_generator *tg110 =
-		dm_alloc(sizeof(struct dce110_timing_generator));
+		kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL);
 
 	if (!tg110)
 		return NULL;
@@ -408,7 +408,7 @@  static struct timing_generator *dce80_timing_generator_create(
 		return &tg110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(tg110);
+	kfree(tg110);
 	return NULL;
 }
 
@@ -417,7 +417,7 @@  static struct output_pixel_processor *dce80_opp_create(
 	uint32_t inst)
 {
 	struct dce110_opp *opp =
-		dm_alloc(sizeof(struct dce110_opp));
+		kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
 
 	if (!opp)
 		return NULL;
@@ -427,7 +427,7 @@  static struct output_pixel_processor *dce80_opp_create(
 		return &opp->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(opp);
+	kfree(opp);
 	return NULL;
 }
 
@@ -436,7 +436,7 @@  static struct stream_encoder *dce80_stream_encoder_create(
 	struct dc_context *ctx)
 {
 	struct dce110_stream_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_stream_encoder));
+		kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -447,7 +447,7 @@  static struct stream_encoder *dce80_stream_encoder_create(
 		return &enc110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -469,7 +469,7 @@  static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dce80_hwseq_create(
 	struct dc_context *ctx)
 {
-	struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+	struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
 	if (hws) {
 		hws->ctx = ctx;
@@ -514,7 +514,8 @@  static struct mem_input *dce80_mem_input_create(
 	struct dc_context *ctx,
 	uint32_t inst)
 {
-	struct dce_mem_input *dce_mi = dm_alloc(sizeof(struct dce_mem_input));
+	struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input),
+					       GFP_KERNEL);
 
 	if (!dce_mi) {
 		BREAK_TO_DEBUGGER();
@@ -528,7 +529,7 @@  static struct mem_input *dce80_mem_input_create(
 
 static void dce80_transform_destroy(struct transform **xfm)
 {
-	dm_free(TO_DCE_TRANSFORM(*xfm));
+	kfree(TO_DCE_TRANSFORM(*xfm));
 	*xfm = NULL;
 }
 
@@ -537,7 +538,7 @@  static struct transform *dce80_transform_create(
 	uint32_t inst)
 {
 	struct dce_transform *transform =
-		dm_alloc(sizeof(struct dce_transform));
+		kzalloc(sizeof(struct dce_transform), GFP_KERNEL);
 
 	if (!transform)
 		return NULL;
@@ -549,7 +550,7 @@  static struct transform *dce80_transform_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(transform);
+	kfree(transform);
 	return NULL;
 }
 
@@ -565,7 +566,7 @@  struct link_encoder *dce80_link_encoder_create(
 	const struct encoder_init_data *enc_init_data)
 {
 	struct dce110_link_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_link_encoder));
+		kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -582,7 +583,7 @@  struct link_encoder *dce80_link_encoder_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -594,7 +595,7 @@  struct clock_source *dce80_clock_source_create(
 	bool dp_clk_src)
 {
 	struct dce110_clk_src *clk_src =
-		dm_alloc(sizeof(struct dce110_clk_src));
+		kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
 	if (!clk_src)
 		return NULL;
@@ -611,14 +612,14 @@  struct clock_source *dce80_clock_source_create(
 
 void dce80_clock_source_destroy(struct clock_source **clk_src)
 {
-	dm_free(TO_DCE110_CLK_SRC(*clk_src));
+	kfree(TO_DCE110_CLK_SRC(*clk_src));
 	*clk_src = NULL;
 }
 
 static struct input_pixel_processor *dce80_ipp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
-	struct dce_ipp *ipp = dm_alloc(sizeof(struct dce_ipp));
+	struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
 
 	if (!ipp) {
 		BREAK_TO_DEBUGGER();
@@ -645,19 +646,19 @@  static void destruct(struct dce110_resource_pool *pool)
 			dce_ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
-			dm_free(TO_DCE_MEM_INPUT(pool->base.mis[i]));
+			kfree(TO_DCE_MEM_INPUT(pool->base.mis[i]));
 			pool->base.mis[i] = NULL;
 		}
 
 		if (pool->base.timing_generators[i] != NULL)	{
-			dm_free(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
+			kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
 			pool->base.timing_generators[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < pool->base.stream_enc_count; i++) {
 		if (pool->base.stream_enc[i] != NULL)
-			dm_free(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
+			kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
 	}
 
 	for (i = 0; i < pool->base.clk_src_count; i++) {
@@ -781,7 +782,7 @@  static void dce80_destroy_resource_pool(struct resource_pool **pool)
 	struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
 
 	destruct(dce110_pool);
-	dm_free(dce110_pool);
+	kfree(dce110_pool);
 	*pool = NULL;
 }
 
@@ -948,7 +949,7 @@  struct resource_pool *dce80_create_resource_pool(
 	struct dc *dc)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
@@ -1113,7 +1114,7 @@  struct resource_pool *dce81_create_resource_pool(
 	struct dc *dc)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
@@ -1274,7 +1275,7 @@  struct resource_pool *dce83_create_resource_pool(
 	struct dc *dc)
 {
 	struct dce110_resource_pool *pool =
-		dm_alloc(sizeof(struct dce110_resource_pool));
+		kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c
index 5e0e2464eab3..67bd6a738fe9 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_ipp.c
@@ -225,7 +225,7 @@  static void ippn10_cursor_set_position(
 
 static void dcn10_ipp_destroy(struct input_pixel_processor **ipp)
 {
-	dm_free(TO_DCN10_IPP(*ipp));
+	kfree(TO_DCN10_IPP(*ipp));
 	*ipp = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c
index 8048782ac599..a136f70b7a3c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_opp.c
@@ -314,7 +314,7 @@  static void oppn10_set_stereo_polarity(
 
 static void dcn10_opp_destroy(struct output_pixel_processor **opp)
 {
-	dm_free(TO_DCN10_OPP(*opp));
+	kfree(TO_DCN10_OPP(*opp));
 	*opp = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
index 298eb44ad9bf..71adda0e5b59 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
@@ -468,7 +468,7 @@  static const struct dc_debug debug_defaults_diags = {
 
 static void dcn10_dpp_destroy(struct transform **xfm)
 {
-	dm_free(TO_DCN10_DPP(*xfm));
+	kfree(TO_DCN10_DPP(*xfm));
 	*xfm = NULL;
 }
 
@@ -477,7 +477,7 @@  static struct transform *dcn10_dpp_create(
 	uint32_t inst)
 {
 	struct dcn10_dpp *dpp =
-		dm_alloc(sizeof(struct dcn10_dpp));
+		kzalloc(sizeof(struct dcn10_dpp), GFP_KERNEL);
 
 	if (!dpp)
 		return NULL;
@@ -487,7 +487,7 @@  static struct transform *dcn10_dpp_create(
 		return &dpp->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(dpp);
+	kfree(dpp);
 	return NULL;
 }
 
@@ -495,7 +495,7 @@  static struct input_pixel_processor *dcn10_ipp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
 	struct dcn10_ipp *ipp =
-		dm_alloc(sizeof(struct dcn10_ipp));
+		kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL);
 
 	if (!ipp) {
 		BREAK_TO_DEBUGGER();
@@ -512,7 +512,7 @@  static struct output_pixel_processor *dcn10_opp_create(
 	struct dc_context *ctx, uint32_t inst)
 {
 	struct dcn10_opp *opp =
-		dm_alloc(sizeof(struct dcn10_opp));
+		kzalloc(sizeof(struct dcn10_opp), GFP_KERNEL);
 
 	if (!opp) {
 		BREAK_TO_DEBUGGER();
@@ -526,7 +526,8 @@  static struct output_pixel_processor *dcn10_opp_create(
 
 static struct mpc *dcn10_mpc_create(struct dc_context *ctx)
 {
-	struct dcn10_mpc *mpc10 = dm_alloc(sizeof(struct dcn10_mpc));
+	struct dcn10_mpc *mpc10 = kzalloc(sizeof(struct dcn10_mpc),
+					  GFP_KERNEL);
 
 	if (!mpc10)
 		return NULL;
@@ -545,7 +546,7 @@  static struct timing_generator *dcn10_timing_generator_create(
 		uint32_t instance)
 {
 	struct dcn10_timing_generator *tgn10 =
-		dm_alloc(sizeof(struct dcn10_timing_generator));
+		kzalloc(sizeof(struct dcn10_timing_generator), GFP_KERNEL);
 
 	if (!tgn10)
 		return NULL;
@@ -577,7 +578,7 @@  struct link_encoder *dcn10_link_encoder_create(
 	const struct encoder_init_data *enc_init_data)
 {
 	struct dce110_link_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_link_encoder));
+		kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -594,7 +595,7 @@  struct link_encoder *dcn10_link_encoder_create(
 	}
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -606,7 +607,7 @@  struct clock_source *dcn10_clock_source_create(
 	bool dp_clk_src)
 {
 	struct dce110_clk_src *clk_src =
-		dm_alloc(sizeof(struct dce110_clk_src));
+		kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
 
 	if (!clk_src)
 		return NULL;
@@ -641,7 +642,7 @@  static struct stream_encoder *dcn10_stream_encoder_create(
 	struct dc_context *ctx)
 {
 	struct dce110_stream_encoder *enc110 =
-		dm_alloc(sizeof(struct dce110_stream_encoder));
+		kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
 
 	if (!enc110)
 		return NULL;
@@ -652,7 +653,7 @@  static struct stream_encoder *dcn10_stream_encoder_create(
 		return &enc110->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc110);
+	kfree(enc110);
 	return NULL;
 }
 
@@ -671,7 +672,7 @@  static const struct dce_hwseq_mask hwseq_mask = {
 static struct dce_hwseq *dcn10_hwseq_create(
 	struct dc_context *ctx)
 {
-	struct dce_hwseq *hws = dm_alloc(sizeof(struct dce_hwseq));
+	struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
 
 	if (hws) {
 		hws->ctx = ctx;
@@ -698,13 +699,13 @@  static const struct resource_create_funcs res_create_maximus_funcs = {
 
 void dcn10_clock_source_destroy(struct clock_source **clk_src)
 {
-	dm_free(TO_DCE110_CLK_SRC(*clk_src));
+	kfree(TO_DCE110_CLK_SRC(*clk_src));
 	*clk_src = NULL;
 }
 
 static struct pp_smu_funcs_rv *dcn10_pp_smu_create(struct dc_context *ctx)
 {
-	struct pp_smu_funcs_rv *pp_smu = dm_alloc(sizeof(*pp_smu));
+	struct pp_smu_funcs_rv *pp_smu = kzalloc(sizeof(*pp_smu), GFP_KERNEL);
 
 	if (!pp_smu)
 		return pp_smu;
@@ -722,13 +723,13 @@  static void destruct(struct dcn10_resource_pool *pool)
 			/* TODO: free dcn version of stream encoder once implemented
 			 * rather than using virtual stream encoder
 			 */
-			dm_free(pool->base.stream_enc[i]);
+			kfree(pool->base.stream_enc[i]);
 			pool->base.stream_enc[i] = NULL;
 		}
 	}
 
 	if (pool->base.mpc != NULL) {
-		dm_free(TO_DCN10_MPC(pool->base.mpc));
+		kfree(TO_DCN10_MPC(pool->base.mpc));
 		pool->base.mpc = NULL;
 	}
 	for (i = 0; i < pool->base.pipe_count; i++) {
@@ -742,7 +743,7 @@  static void destruct(struct dcn10_resource_pool *pool)
 			pool->base.ipps[i]->funcs->ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
-			dm_free(TO_DCN10_MEM_INPUT(pool->base.mis[i]));
+			kfree(TO_DCN10_MEM_INPUT(pool->base.mis[i]));
 			pool->base.mis[i] = NULL;
 		}
 
@@ -751,14 +752,14 @@  static void destruct(struct dcn10_resource_pool *pool)
 		}
 
 		if (pool->base.timing_generators[i] != NULL)	{
-			dm_free(DCN10TG_FROM_TG(pool->base.timing_generators[i]));
+			kfree(DCN10TG_FROM_TG(pool->base.timing_generators[i]));
 			pool->base.timing_generators[i] = NULL;
 		}
 	}
 
 	for (i = 0; i < pool->base.stream_enc_count; i++) {
 		if (pool->base.stream_enc[i] != NULL)
-		dm_free(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
+		kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
 	}
 
 	for (i = 0; i < pool->base.audio_count; i++) {
@@ -767,7 +768,7 @@  static void destruct(struct dcn10_resource_pool *pool)
 	}
 
 	for (i = 0; i < pool->base.res_cap->num_dwb; i++) {
-		dm_free(pool->base.dwbc[i]);
+		kfree(pool->base.dwbc[i]);
 		pool->base.dwbc[i] = NULL;
 	}
 
@@ -792,7 +793,7 @@  static void destruct(struct dcn10_resource_pool *pool)
 	if (pool->base.display_clock != NULL)
 		dce_disp_clk_destroy(&pool->base.display_clock);
 
-	dm_free(pool->base.pp_smu);
+	kfree(pool->base.pp_smu);
 }
 
 static struct mem_input *dcn10_mem_input_create(
@@ -800,7 +801,7 @@  static struct mem_input *dcn10_mem_input_create(
 	uint32_t inst)
 {
 	struct dcn10_mem_input *mem_inputn10 =
-		dm_alloc(sizeof(struct dcn10_mem_input));
+		kzalloc(sizeof(struct dcn10_mem_input), GFP_KERNEL);
 
 	if (!mem_inputn10)
 		return NULL;
@@ -810,7 +811,7 @@  static struct mem_input *dcn10_mem_input_create(
 		return &mem_inputn10->base;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(mem_inputn10);
+	kfree(mem_inputn10);
 	return NULL;
 }
 
@@ -1207,7 +1208,7 @@  static void dcn10_destroy_resource_pool(struct resource_pool **pool)
 	struct dcn10_resource_pool *dcn10_pool = TO_DCN10_RES_POOL(*pool);
 
 	destruct(dcn10_pool);
-	dm_free(dcn10_pool);
+	kfree(dcn10_pool);
 	*pool = NULL;
 }
 
@@ -1239,7 +1240,8 @@  static bool dcn10_dwbc_create(struct dc_context *ctx, struct resource_pool *pool
 	uint32_t dwb_count = pool->res_cap->num_dwb;
 
 	for (i = 0; i < dwb_count; i++) {
-		struct dcn10_dwbc *dwbc10 = dm_alloc(sizeof(struct dcn10_dwbc));
+		struct dcn10_dwbc *dwbc10 = kzalloc(sizeof(struct dcn10_dwbc),
+						    GFP_KERNEL);
 
 		if (!dwbc10) {
 			dm_error("DC: failed to create dwbc10!\n");
@@ -1517,7 +1519,7 @@  struct resource_pool *dcn10_create_resource_pool(
 		struct dc *dc)
 {
 	struct dcn10_resource_pool *pool =
-		dm_alloc(sizeof(struct dcn10_resource_pool));
+		kzalloc(sizeof(struct dcn10_resource_pool), GFP_KERNEL);
 
 	if (!pool)
 		return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
index d42eb3de2ea4..1d1efd72b291 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c
@@ -239,7 +239,7 @@  struct gpio *dal_gpio_create(
 	uint32_t en,
 	enum gpio_pin_output_state output_state)
 {
-	struct gpio *gpio = dm_alloc(sizeof(struct gpio));
+	struct gpio *gpio = kzalloc(sizeof(struct gpio), GFP_KERNEL);
 
 	if (!gpio) {
 		ASSERT_CRITICAL(false);
@@ -266,7 +266,7 @@  void dal_gpio_destroy(
 
 	dal_gpio_close(*gpio);
 
-	dm_free(*gpio);
+	kfree(*gpio);
 
 	*gpio = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
index eeb1cd0f75a6..d4e5ef64e489 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
@@ -59,7 +59,7 @@  struct gpio_service *dal_gpio_service_create(
 
 	uint32_t index_of_id;
 
-	service = dm_alloc(sizeof(struct gpio_service));
+	service = kzalloc(sizeof(struct gpio_service), GFP_KERNEL);
 
 	if (!service) {
 		BREAK_TO_DEBUGGER();
@@ -98,7 +98,8 @@  struct gpio_service *dal_gpio_service_create(
 			if (number_of_bits) {
 				uint32_t index_of_uint = 0;
 
-				slot = dm_alloc(number_of_uints * sizeof(uint32_t));
+				slot = kzalloc(number_of_uints * sizeof(uint32_t),
+					       GFP_KERNEL);
 
 				if (!slot) {
 					BREAK_TO_DEBUGGER();
@@ -130,11 +131,11 @@  struct gpio_service *dal_gpio_service_create(
 		slot = service->busyness[index_of_id];
 
 		if (slot)
-			dm_free(slot);
+			kfree(slot);
 	};
 
 failure_1:
-	dm_free(service);
+	kfree(service);
 
 	return NULL;
 }
@@ -171,13 +172,13 @@  void dal_gpio_service_destroy(
 			uint32_t *slot = (*ptr)->busyness[index_of_id];
 
 			if (slot)
-				dm_free(slot);
+				kfree(slot);
 
 			++index_of_id;
 		} while (index_of_id < GPIO_ID_COUNT);
 	}
 
-	dm_free(*ptr);
+	kfree(*ptr);
 
 	*ptr = NULL;
 }
@@ -399,7 +400,7 @@  void dal_gpio_destroy_irq(
 
 	dal_gpio_close(*irq);
 	dal_gpio_destroy(irq);
-	dm_free(*irq);
+	kfree(*irq);
 
 	*irq = NULL;
 }
@@ -417,7 +418,7 @@  struct ddc *dal_gpio_create_ddc(
 	if (!service->translate.funcs->offset_to_id(offset, mask, &id, &en))
 		return NULL;
 
-	ddc = dm_alloc(sizeof(struct ddc));
+	ddc = kzalloc(sizeof(struct ddc), GFP_KERNEL);
 
 	if (!ddc) {
 		BREAK_TO_DEBUGGER();
@@ -450,7 +451,7 @@  struct ddc *dal_gpio_create_ddc(
 	dal_gpio_destroy(&ddc->pin_data);
 
 failure_1:
-	dm_free(ddc);
+	kfree(ddc);
 
 	return NULL;
 }
@@ -466,7 +467,7 @@  void dal_gpio_destroy_ddc(
 	dal_ddc_close(*ddc);
 	dal_gpio_destroy(&(*ddc)->pin_data);
 	dal_gpio_destroy(&(*ddc)->pin_clock);
-	dm_free(*ddc);
+	kfree(*ddc);
 
 	*ddc = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
index 47e0f8f24a86..7b6efa4f2efd 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
@@ -55,7 +55,7 @@  static void destroy(
 
 	destruct(pin);
 
-	dm_free(pin);
+	kfree(pin);
 
 	*ptr = NULL;
 }
@@ -225,7 +225,7 @@  struct hw_gpio_pin *dal_hw_ddc_create(
 	enum gpio_id id,
 	uint32_t en)
 {
-	struct hw_ddc *pin = dm_alloc(sizeof(struct hw_ddc));
+	struct hw_ddc *pin = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL);
 
 	if (!pin) {
 		ASSERT_CRITICAL(false);
@@ -237,7 +237,7 @@  struct hw_gpio_pin *dal_hw_ddc_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(pin);
+	kfree(pin);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c
index f7d049c0e62a..87b580fa4bc9 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_factory.c
@@ -101,7 +101,7 @@  void dal_hw_factory_destroy(
 		return;
 	}
 
-	dm_free(*factory);
+	kfree(*factory);
 
 	*factory = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
index 9634e8841d90..0c255c02045b 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c
@@ -72,7 +72,7 @@  static void destroy(
 
 	destruct(hpd);
 
-	dm_free(hpd);
+	kfree(hpd);
 
 	*ptr = NULL;
 }
@@ -157,7 +157,7 @@  struct hw_gpio_pin *dal_hw_hpd_create(
 	enum gpio_id id,
 	uint32_t en)
 {
-	struct hw_hpd *hpd = dm_alloc(sizeof(struct hw_hpd));
+	struct hw_hpd *hpd = kzalloc(sizeof(struct hw_hpd), GFP_KERNEL);
 
 	if (!hpd) {
 		ASSERT_CRITICAL(false);
@@ -169,7 +169,7 @@  struct hw_gpio_pin *dal_hw_hpd_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(hpd);
+	kfree(hpd);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce100/i2caux_dce100.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce100/i2caux_dce100.c
index 0712cafb4c42..c45a2ee8c336 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce100/i2caux_dce100.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce100/i2caux_dce100.c
@@ -88,7 +88,7 @@  struct i2caux *dal_i2caux_dce100_create(
 	struct dc_context *ctx)
 {
 	struct i2caux_dce110 *i2caux_dce110 =
-		dm_alloc(sizeof(struct i2caux_dce110));
+		kzalloc(sizeof(struct i2caux_dce110), GFP_KERNEL);
 
 	if (!i2caux_dce110) {
 		ASSERT_CRITICAL(false);
@@ -106,7 +106,7 @@  struct i2caux *dal_i2caux_dce100_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(i2caux_dce110);
+	kfree(i2caux_dce110);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c
index d3eaf8977a60..4b673b48bf42 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/aux_engine_dce110.c
@@ -87,7 +87,7 @@  static void destroy(
 
 	destruct(engine);
 
-	dm_free(engine);
+	kfree(engine);
 
 	*aux_engine = NULL;
 }
@@ -464,7 +464,7 @@  struct aux_engine *dal_aux_engine_dce110_create(
 		return NULL;
 	}
 
-	engine = dm_alloc(sizeof(*engine));
+	engine = kzalloc(sizeof(*engine), GFP_KERNEL);
 
 	if (!engine) {
 		ASSERT_CRITICAL(false);
@@ -476,7 +476,7 @@  struct aux_engine *dal_aux_engine_dce110_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(engine);
+	kfree(engine);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c
index 80d06ad78e07..aab77a81008a 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_hw_engine_dce110.c
@@ -469,7 +469,7 @@  static void destroy(
 
 	dal_i2c_hw_engine_destruct(&engine_dce110->base);
 
-	dm_free(engine_dce110);
+	kfree(engine_dce110);
 
 	*i2c_engine = NULL;
 }
@@ -559,7 +559,8 @@  struct i2c_engine *dal_i2c_hw_engine_dce110_create(
 		return NULL;
 	}
 
-	engine_dce10 = dm_alloc(sizeof(struct i2c_hw_engine_dce110));
+	engine_dce10 = kzalloc(sizeof(struct i2c_hw_engine_dce110),
+			       GFP_KERNEL);
 
 	if (!engine_dce10) {
 		ASSERT_CRITICAL(false);
@@ -571,7 +572,7 @@  struct i2c_engine *dal_i2c_hw_engine_dce110_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(engine_dce10);
+	kfree(engine_dce10);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_sw_engine_dce110.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_sw_engine_dce110.c
index 996813d9165f..bf2c4b240b78 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_sw_engine_dce110.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2c_sw_engine_dce110.c
@@ -88,7 +88,7 @@  static void destroy(
 
 	destruct(sw_engine);
 
-	dm_free(sw_engine);
+	kfree(sw_engine);
 
 	*engine = NULL;
 }
@@ -153,7 +153,8 @@  struct i2c_engine *dal_i2c_sw_engine_dce110_create(
 		return NULL;
 	}
 
-	engine_dce110 = dm_alloc(sizeof(struct i2c_sw_engine_dce110));
+	engine_dce110 = kzalloc(sizeof(struct i2c_sw_engine_dce110),
+				GFP_KERNEL);
 
 	if (!engine_dce110) {
 		ASSERT_CRITICAL(false);
@@ -165,7 +166,7 @@  struct i2c_engine *dal_i2c_sw_engine_dce110_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(engine_dce110);
+	kfree(engine_dce110);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2caux_dce110.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2caux_dce110.c
index 1c00ed0010d9..ae9adb389319 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2caux_dce110.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2caux_dce110.c
@@ -68,7 +68,7 @@  static void destroy(
 
 	destruct(i2caux_dce110);
 
-	dm_free(i2caux_dce110);
+	kfree(i2caux_dce110);
 
 	*i2c_engine = NULL;
 }
@@ -299,7 +299,7 @@  struct i2caux *dal_i2caux_dce110_create(
 	struct dc_context *ctx)
 {
 	struct i2caux_dce110 *i2caux_dce110 =
-		dm_alloc(sizeof(struct i2caux_dce110));
+		kzalloc(sizeof(struct i2caux_dce110), GFP_KERNEL);
 
 	if (!i2caux_dce110) {
 		ASSERT_CRITICAL(false);
@@ -317,7 +317,7 @@  struct i2caux *dal_i2caux_dce110_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(i2caux_dce110);
+	kfree(i2caux_dce110);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce112/i2caux_dce112.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce112/i2caux_dce112.c
index d74f3f15d600..715ba4390957 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce112/i2caux_dce112.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce112/i2caux_dce112.c
@@ -122,7 +122,7 @@  struct i2caux *dal_i2caux_dce112_create(
 	struct dc_context *ctx)
 {
 	struct i2caux_dce110 *i2caux_dce110 =
-		dm_alloc(sizeof(struct i2caux_dce110));
+		kzalloc(sizeof(struct i2caux_dce110), GFP_KERNEL);
 
 	if (!i2caux_dce110) {
 		ASSERT_CRITICAL(false);
@@ -134,7 +134,7 @@  struct i2caux *dal_i2caux_dce112_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(i2caux_dce110);
+	kfree(i2caux_dce110);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce120/i2caux_dce120.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce120/i2caux_dce120.c
index 91198295f1a4..d52827ae3f1a 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce120/i2caux_dce120.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce120/i2caux_dce120.c
@@ -101,7 +101,7 @@  struct i2caux *dal_i2caux_dce120_create(
 	struct dc_context *ctx)
 {
 	struct i2caux_dce110 *i2caux_dce110 =
-		dm_alloc(sizeof(struct i2caux_dce110));
+		kzalloc(sizeof(struct i2caux_dce110), GFP_KERNEL);
 
 	if (!i2caux_dce110) {
 		ASSERT_CRITICAL(false);
@@ -119,7 +119,7 @@  struct i2caux *dal_i2caux_dce120_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(i2caux_dce110);
+	kfree(i2caux_dce110);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_hw_engine_dce80.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_hw_engine_dce80.c
index 423c38ac880c..d41e37c94214 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_hw_engine_dce80.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_hw_engine_dce80.c
@@ -190,7 +190,7 @@  static void destroy(
 
 	destruct(engine);
 
-	dm_free(engine);
+	kfree(engine);
 
 	*i2c_engine = NULL;
 }
@@ -867,7 +867,7 @@  struct i2c_engine *dal_i2c_hw_engine_dce80_create(
 		return NULL;
 	}
 
-	engine = dm_alloc(sizeof(struct i2c_hw_engine_dce80));
+	engine = kzalloc(sizeof(struct i2c_hw_engine_dce80), GFP_KERNEL);
 
 	if (!engine) {
 		BREAK_TO_DEBUGGER();
@@ -879,7 +879,7 @@  struct i2c_engine *dal_i2c_hw_engine_dce80_create(
 
 	BREAK_TO_DEBUGGER();
 
-	dm_free(engine);
+	kfree(engine);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_sw_engine_dce80.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_sw_engine_dce80.c
index 804a3266c578..6be77bc931c6 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_sw_engine_dce80.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2c_sw_engine_dce80.c
@@ -103,7 +103,7 @@  static void destroy(
 
 	destruct(sw_engine);
 
-	dm_free(sw_engine);
+	kfree(sw_engine);
 
 	*engine = NULL;
 }
@@ -165,7 +165,7 @@  struct i2c_engine *dal_i2c_sw_engine_dce80_create(
 		return NULL;
 	}
 
-	engine = dm_alloc(sizeof(struct i2c_sw_engine_dce80));
+	engine = kzalloc(sizeof(struct i2c_sw_engine_dce80), GFP_KERNEL);
 
 	if (!engine) {
 		BREAK_TO_DEBUGGER();
@@ -177,7 +177,7 @@  struct i2c_engine *dal_i2c_sw_engine_dce80_create(
 
 	BREAK_TO_DEBUGGER();
 
-	dm_free(engine);
+	kfree(engine);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2caux_dce80.c b/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2caux_dce80.c
index 5e71450c44e0..d3c157e5eccd 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2caux_dce80.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dce80/i2caux_dce80.c
@@ -101,7 +101,7 @@  static void destroy(
 
 	destruct(i2caux_dce80);
 
-	dm_free(i2caux_dce80);
+	kfree(i2caux_dce80);
 
 	*i2c_engine = NULL;
 }
@@ -277,7 +277,7 @@  struct i2caux *dal_i2caux_dce80_create(
 	struct dc_context *ctx)
 {
 	struct i2caux_dce80 *i2caux_dce80 =
-		dm_alloc(sizeof(struct i2caux_dce80));
+		kzalloc(sizeof(struct i2caux_dce80), GFP_KERNEL);
 
 	if (!i2caux_dce80) {
 		BREAK_TO_DEBUGGER();
@@ -289,7 +289,7 @@  struct i2caux *dal_i2caux_dce80_create(
 
 	BREAK_TO_DEBUGGER();
 
-	dm_free(i2caux_dce80);
+	kfree(i2caux_dce80);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/dcn10/i2caux_dcn10.c b/drivers/gpu/drm/amd/display/dc/i2caux/dcn10/i2caux_dcn10.c
index 9f17d2e4376b..f8659f1c5f9d 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/dcn10/i2caux_dcn10.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/dcn10/i2caux_dcn10.c
@@ -101,7 +101,7 @@  struct i2caux *dal_i2caux_dcn10_create(
 	struct dc_context *ctx)
 {
 	struct i2caux_dce110 *i2caux_dce110 =
-		dm_alloc(sizeof(struct i2caux_dce110));
+		kzalloc(sizeof(struct i2caux_dce110), GFP_KERNEL);
 
 	if (!i2caux_dce110) {
 		ASSERT_CRITICAL(false);
@@ -119,7 +119,7 @@  struct i2caux *dal_i2caux_dcn10_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(i2caux_dce110);
+	kfree(i2caux_dce110);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/diagnostics/i2caux_diag.c b/drivers/gpu/drm/amd/display/dc/i2caux/diagnostics/i2caux_diag.c
index 029bf735036c..1fdb3252920b 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/diagnostics/i2caux_diag.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/diagnostics/i2caux_diag.c
@@ -59,7 +59,7 @@  static void destroy(
 {
 	destruct(*i2c_engine);
 
-	dm_free(*i2c_engine);
+	kfree(*i2c_engine);
 
 	*i2c_engine = NULL;
 }
@@ -90,7 +90,8 @@  static bool construct(
 struct i2caux *dal_i2caux_diag_fpga_create(
 	struct dc_context *ctx)
 {
-	struct i2caux *i2caux =	dm_alloc(sizeof(struct i2caux));
+	struct i2caux *i2caux =	kzalloc(sizeof(struct i2caux),
+					       GFP_KERNEL);
 
 	if (!i2caux) {
 		ASSERT_CRITICAL(false);
@@ -102,7 +103,7 @@  struct i2caux *dal_i2caux_diag_fpga_create(
 
 	ASSERT_CRITICAL(false);
 
-	dm_free(i2caux);
+	kfree(i2caux);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/i2caux/i2c_sw_engine.c b/drivers/gpu/drm/amd/display/dc/i2caux/i2c_sw_engine.c
index 95bc4457d44b..9d0077ade12c 100644
--- a/drivers/gpu/drm/amd/display/dc/i2caux/i2c_sw_engine.c
+++ b/drivers/gpu/drm/amd/display/dc/i2caux/i2c_sw_engine.c
@@ -541,7 +541,7 @@  static void destroy(
 {
 	dal_i2c_sw_engine_destruct(FROM_I2C_ENGINE(*ptr));
 
-	dm_free(*ptr);
+	kfree(*ptr);
 	*ptr = NULL;
 }
 
@@ -592,7 +592,7 @@  struct i2c_engine *dal_i2c_sw_engine_create(
 		return NULL;
 	}
 
-	engine = dm_alloc(sizeof(struct i2c_sw_engine));
+	engine = kzalloc(sizeof(struct i2c_sw_engine), GFP_KERNEL);
 
 	if (!engine) {
 		BREAK_TO_DEBUGGER();
@@ -604,7 +604,7 @@  struct i2c_engine *dal_i2c_sw_engine_create(
 
 	BREAK_TO_DEBUGGER();
 
-	dm_free(engine);
+	kfree(engine);
 
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c b/drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c
index 7cce28489dba..a6c3a7229def 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/dce110/irq_service_dce110.c
@@ -422,7 +422,8 @@  bool construct(
 struct irq_service *dal_irq_service_dce110_create(
 	struct irq_service_init_data *init_data)
 {
-	struct irq_service *irq_service = dm_alloc(sizeof(*irq_service));
+	struct irq_service *irq_service = kzalloc(sizeof(*irq_service),
+						  GFP_KERNEL);
 
 	if (!irq_service)
 		return NULL;
@@ -430,6 +431,6 @@  struct irq_service *dal_irq_service_dce110_create(
 	if (construct(irq_service, init_data))
 		return irq_service;
 
-	dm_free(irq_service);
+	kfree(irq_service);
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/irq/dce120/irq_service_dce120.c b/drivers/gpu/drm/amd/display/dc/irq/dce120/irq_service_dce120.c
index 3871633ac635..61d7c286802a 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/dce120/irq_service_dce120.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/dce120/irq_service_dce120.c
@@ -281,7 +281,8 @@  static bool construct(
 struct irq_service *dal_irq_service_dce120_create(
 	struct irq_service_init_data *init_data)
 {
-	struct irq_service *irq_service = dm_alloc(sizeof(*irq_service));
+	struct irq_service *irq_service = kzalloc(sizeof(*irq_service),
+						  GFP_KERNEL);
 
 	if (!irq_service)
 		return NULL;
@@ -289,6 +290,6 @@  struct irq_service *dal_irq_service_dce120_create(
 	if (construct(irq_service, init_data))
 		return irq_service;
 
-	dm_free(irq_service);
+	kfree(irq_service);
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/irq/dce80/irq_service_dce80.c b/drivers/gpu/drm/amd/display/dc/irq/dce80/irq_service_dce80.c
index f458ef8e4c57..d6e1fb665d90 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/dce80/irq_service_dce80.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/dce80/irq_service_dce80.c
@@ -293,7 +293,8 @@  static bool construct(
 struct irq_service *dal_irq_service_dce80_create(
 	struct irq_service_init_data *init_data)
 {
-	struct irq_service *irq_service = dm_alloc(sizeof(*irq_service));
+	struct irq_service *irq_service = kzalloc(sizeof(*irq_service),
+						  GFP_KERNEL);
 
 	if (!irq_service)
 		return NULL;
@@ -301,7 +302,7 @@  struct irq_service *dal_irq_service_dce80_create(
 	if (construct(irq_service, init_data))
 		return irq_service;
 
-	dm_free(irq_service);
+	kfree(irq_service);
 	return NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c b/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
index be59f0a654e2..f6e861162a6e 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/dcn10/irq_service_dcn10.c
@@ -348,7 +348,8 @@  static bool construct(
 struct irq_service *dal_irq_service_dcn10_create(
 	struct irq_service_init_data *init_data)
 {
-	struct irq_service *irq_service = dm_alloc(sizeof(*irq_service));
+	struct irq_service *irq_service = kzalloc(sizeof(*irq_service),
+						  GFP_KERNEL);
 
 	if (!irq_service)
 		return NULL;
@@ -356,6 +357,6 @@  struct irq_service *dal_irq_service_dcn10_create(
 	if (construct(irq_service, init_data))
 		return irq_service;
 
-	dm_free(irq_service);
+	kfree(irq_service);
 	return NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
index 0a1fae4ef83a..ce20622c7c89 100644
--- a/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
+++ b/drivers/gpu/drm/amd/display/dc/irq/irq_service.c
@@ -66,7 +66,7 @@  void dal_irq_service_destroy(struct irq_service **irq_service)
 		return;
 	}
 
-	dm_free(*irq_service);
+	kfree(*irq_service);
 
 	*irq_service = NULL;
 }
diff --git a/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c b/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c
index 57b5a3babdf8..db513abd735a 100644
--- a/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c
@@ -87,7 +87,7 @@  static void virtual_link_encoder_connect_dig_be_to_fe(
 
 static void virtual_link_encoder_destroy(struct link_encoder **enc)
 {
-	dm_free(*enc);
+	kfree(*enc);
 	*enc = NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c
index 7fe6085e6e37..3dc1733eea20 100644
--- a/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/virtual/virtual_stream_encoder.c
@@ -121,7 +121,7 @@  bool virtual_stream_encoder_construct(
 struct stream_encoder *virtual_stream_encoder_create(
 	struct dc_context *ctx, struct dc_bios *bp)
 {
-	struct stream_encoder *enc = dm_alloc(sizeof(*enc));
+	struct stream_encoder *enc = kzalloc(sizeof(*enc), GFP_KERNEL);
 
 	if (!enc)
 		return NULL;
@@ -130,7 +130,7 @@  struct stream_encoder *virtual_stream_encoder_create(
 		return enc;
 
 	BREAK_TO_DEBUGGER();
-	dm_free(enc);
+	kfree(enc);
 	return NULL;
 }
 
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 52350d0e68d0..4d7db4aa28e0 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -143,7 +143,7 @@  static bool check_dc_support(const struct dc *dc)
 struct mod_freesync *mod_freesync_create(struct dc *dc)
 {
 	struct core_freesync *core_freesync =
-			dm_alloc(sizeof(struct core_freesync));
+			kzalloc(sizeof(struct core_freesync), GFP_KERNEL);
 
 
 	struct persistent_data_flag flag;
@@ -153,8 +153,8 @@  struct mod_freesync *mod_freesync_create(struct dc *dc)
 	if (core_freesync == NULL)
 		goto fail_alloc_context;
 
-	core_freesync->map = dm_alloc(sizeof(struct freesync_entity) *
-			MOD_FREESYNC_MAX_CONCURRENT_STREAMS);
+	core_freesync->map = kzalloc(sizeof(struct freesync_entity) * MOD_FREESYNC_MAX_CONCURRENT_STREAMS,
+				     GFP_KERNEL);
 
 	if (core_freesync->map == NULL)
 		goto fail_alloc_map;
@@ -197,10 +197,10 @@  struct mod_freesync *mod_freesync_create(struct dc *dc)
 	return &core_freesync->public;
 
 fail_construct:
-	dm_free(core_freesync->map);
+	kfree(core_freesync->map);
 
 fail_alloc_map:
-	dm_free(core_freesync);
+	kfree(core_freesync);
 
 fail_alloc_context:
 	return NULL;
@@ -217,9 +217,9 @@  void mod_freesync_destroy(struct mod_freesync *mod_freesync)
 			if (core_freesync->map[i].stream)
 				dc_stream_release(core_freesync->map[i].stream);
 
-		dm_free(core_freesync->map);
+		kfree(core_freesync->map);
 
-		dm_free(core_freesync);
+		kfree(core_freesync);
 	}
 }