diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-21 11:02:58 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-02-21 11:02:58 -0800 |
| commit | 8934827db5403eae57d4537114a9ff88b0a8460f (patch) | |
| tree | 5167aa7e16b786b9135e19d508b234054fa6e8ce /drivers/gpu/drm/amd/display | |
| parent | c7decec2f2d2ab0366567f9e30c0e1418cece43f (diff) | |
| parent | 7a70c15bd1449f1eb30991772edce37b41e496fb (diff) | |
Merge tag 'kmalloc_obj-treewide-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linuxHEADmaster
Pull kmalloc_obj conversion from Kees Cook:
"This does the tree-wide conversion to kmalloc_obj() and friends using
coccinelle, with a subsequent small manual cleanup of whitespace
alignment that coccinelle does not handle.
This uncovered a clang bug in __builtin_counted_by_ref(), so the
conversion is preceded by disabling that for current versions of
clang. The imminent clang 22.1 release has the fix.
I've done allmodconfig build tests for x86_64, arm64, i386, and arm. I
did defconfig builds for alpha, m68k, mips, parisc, powerpc, riscv,
s390, sparc, sh, arc, csky, xtensa, hexagon, and openrisc"
* tag 'kmalloc_obj-treewide-v7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
kmalloc_obj: Clean up after treewide replacements
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
compiler_types: Disable __builtin_counted_by_ref for Clang
Diffstat (limited to 'drivers/gpu/drm/amd/display')
103 files changed, 766 insertions, 745 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index c3c045c8144f..10bc1d252b1f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -545,13 +545,15 @@ static void schedule_dc_vmin_vmax(struct amdgpu_device *adev, struct dc_stream_state *stream, struct dc_crtc_timing_adjust *adjust) { - struct vupdate_offload_work *offload_work = kzalloc(sizeof(*offload_work), GFP_NOWAIT); + struct vupdate_offload_work *offload_work = kzalloc_obj(*offload_work, + GFP_NOWAIT); if (!offload_work) { drm_dbg_driver(adev_to_drm(adev), "Failed to allocate vupdate_offload_work\n"); return; } - struct dc_crtc_timing_adjust *adjust_copy = kzalloc(sizeof(*adjust_copy), GFP_NOWAIT); + struct dc_crtc_timing_adjust *adjust_copy = kzalloc_obj(*adjust_copy, + GFP_NOWAIT); if (!adjust_copy) { drm_dbg_driver(adev_to_drm(adev), "Failed to allocate adjust_copy\n"); kfree(offload_work); @@ -1023,7 +1025,8 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params) continue; } if (dm->dmub_thread_offload[notify.type] == true) { - dmub_hpd_wrk = kzalloc(sizeof(*dmub_hpd_wrk), GFP_ATOMIC); + dmub_hpd_wrk = kzalloc_obj(*dmub_hpd_wrk, + GFP_ATOMIC); if (!dmub_hpd_wrk) { drm_err(adev_to_drm(adev), "Failed to allocate dmub_hpd_wrk"); return; @@ -1647,7 +1650,8 @@ static struct hpd_rx_irq_offload_work_queue *hpd_rx_irq_create_workqueue(struct int i = 0; struct hpd_rx_irq_offload_work_queue *hpd_rx_offload_wq = NULL; - hpd_rx_offload_wq = kcalloc(max_caps, sizeof(*hpd_rx_offload_wq), GFP_KERNEL); + hpd_rx_offload_wq = kzalloc_objs(*hpd_rx_offload_wq, max_caps, + GFP_KERNEL); if (!hpd_rx_offload_wq) return NULL; @@ -1720,7 +1724,7 @@ dm_allocate_gpu_mem( AMDGPU_GEM_DOMAIN_GTT : AMDGPU_GEM_DOMAIN_VRAM; int ret; - da = kzalloc(sizeof(struct dal_allocation), GFP_KERNEL); + da = kzalloc_obj(struct dal_allocation, GFP_KERNEL); if (!da) return NULL; @@ -2126,7 +2130,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) } if (dc_is_dmub_outbox_supported(adev->dm.dc)) { init_completion(&adev->dm.dmub_aux_transfer_done); - adev->dm.dmub_notify = kzalloc(sizeof(struct dmub_notification), GFP_KERNEL); + adev->dm.dmub_notify = kzalloc_obj(struct dmub_notification, + GFP_KERNEL); if (!adev->dm.dmub_notify) { drm_info(adev_to_drm(adev), "fail to allocate adev->dm.dmub_notify"); goto error; @@ -2521,7 +2526,7 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) } - adev->dm.dmub_srv = kzalloc(sizeof(*adev->dm.dmub_srv), GFP_KERNEL); + adev->dm.dmub_srv = kzalloc_obj(*adev->dm.dmub_srv, GFP_KERNEL); dmub_srv = adev->dm.dmub_srv; if (!dmub_srv) { @@ -2602,8 +2607,7 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) memory_params.region_info = ®ion_info; memory_params.window_memory_type = window_memory_type; - adev->dm.dmub_fb_info = - kzalloc(sizeof(*adev->dm.dmub_fb_info), GFP_KERNEL); + adev->dm.dmub_fb_info = kzalloc_obj(*adev->dm.dmub_fb_info, GFP_KERNEL); fb_info = adev->dm.dmub_fb_info; if (!fb_info) { @@ -3359,7 +3363,7 @@ static void dm_gpureset_commit_state(struct dc_state *dc_state, } *bundle __free(kfree); int k, m; - bundle = kzalloc(sizeof(*bundle), GFP_KERNEL); + bundle = kzalloc_obj(*bundle, GFP_KERNEL); if (!bundle) { drm_err(dm->ddev, "Failed to allocate update bundle\n"); @@ -3927,7 +3931,7 @@ void amdgpu_dm_update_connector_after_detect( if (!aconnector->timing_requested) { aconnector->timing_requested = - kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL); + kzalloc_obj(struct dc_crtc_timing, GFP_KERNEL); if (!aconnector->timing_requested) drm_err(dev, "failed to create aconnector->requested_timing\n"); @@ -4156,8 +4160,8 @@ static void handle_hpd_irq(void *param) static void schedule_hpd_rx_offload_work(struct amdgpu_device *adev, struct hpd_rx_irq_offload_work_queue *offload_wq, union hpd_irq_data hpd_irq_data) { - struct hpd_rx_irq_offload_work *offload_work = - kzalloc(sizeof(*offload_work), GFP_KERNEL); + struct hpd_rx_irq_offload_work *offload_work = kzalloc_obj(*offload_work, + GFP_KERNEL); if (!offload_work) { drm_err(adev_to_drm(adev), "Failed to allocate hpd_rx_irq_offload_work.\n"); @@ -4878,7 +4882,7 @@ dm_atomic_duplicate_state(struct drm_private_obj *obj) { struct dm_atomic_state *old_state, *new_state; - new_state = kzalloc(sizeof(*new_state), GFP_KERNEL); + new_state = kzalloc_obj(*new_state, GFP_KERNEL); if (!new_state) return NULL; @@ -4935,7 +4939,7 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) /* indicates support for immediate flip */ adev_to_drm(adev)->mode_config.async_page_flip = true; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return -ENOMEM; @@ -5363,7 +5367,7 @@ static int initialize_plane(struct amdgpu_display_manager *dm, unsigned long possible_crtcs; int ret = 0; - plane = kzalloc(sizeof(struct drm_plane), GFP_KERNEL); + plane = kzalloc_obj(struct drm_plane, GFP_KERNEL); if (!plane) { drm_err(adev_to_drm(dm->adev), "KMS: Failed to allocate plane\n"); return -ENOMEM; @@ -5602,7 +5606,8 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) link = dc_get_link_at_index(dm->dc, i); if (link->connector_signal == SIGNAL_TYPE_VIRTUAL) { - struct amdgpu_dm_wb_connector *wbcon = kzalloc(sizeof(*wbcon), GFP_KERNEL); + struct amdgpu_dm_wb_connector *wbcon = kzalloc_obj(*wbcon, + GFP_KERNEL); if (!wbcon) { drm_err(adev_to_drm(adev), "KMS: Failed to allocate writeback connector\n"); @@ -5621,11 +5626,11 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) continue; } - aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); + aconnector = kzalloc_obj(*aconnector, GFP_KERNEL); if (!aconnector) goto fail; - aencoder = kzalloc(sizeof(*aencoder), GFP_KERNEL); + aencoder = kzalloc_obj(*aencoder, GFP_KERNEL); if (!aencoder) goto fail; @@ -7819,7 +7824,7 @@ void amdgpu_dm_connector_funcs_reset(struct drm_connector *connector) kfree(state); - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (state) { state->scaling = RMX_OFF; @@ -9094,7 +9099,7 @@ static int amdgpu_dm_i2c_xfer(struct i2c_adapter *i2c_adap, if (!ddc_service->ddc_pin) return result; - cmd.payloads = kcalloc(num, sizeof(struct i2c_payload), GFP_KERNEL); + cmd.payloads = kzalloc_objs(struct i2c_payload, num, GFP_KERNEL); if (!cmd.payloads) return result; @@ -9143,7 +9148,7 @@ create_i2c(struct ddc_service *ddc_service, bool oem) struct amdgpu_device *adev = ddc_service->ctx->driver_context; struct amdgpu_i2c_adapter *i2c; - i2c = kzalloc(sizeof(struct amdgpu_i2c_adapter), GFP_KERNEL); + i2c = kzalloc_obj(struct amdgpu_i2c_adapter, GFP_KERNEL); if (!i2c) return NULL; i2c->base.owner = THIS_MODULE; @@ -9944,7 +9949,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, struct dc_stream_update stream_update; } *bundle; - bundle = kzalloc(sizeof(*bundle), GFP_KERNEL); + bundle = kzalloc_obj(*bundle, GFP_KERNEL); if (!bundle) { drm_err(dev, "Failed to allocate update bundle\n"); @@ -10619,7 +10624,7 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm, struct amdgpu_framebuffer *afb; int i = 0; - wb_info = kzalloc(sizeof(*wb_info), GFP_KERNEL); + wb_info = kzalloc_obj(*wb_info, GFP_KERNEL); if (!wb_info) { drm_err(adev_to_drm(adev), "Failed to allocate wb_info\n"); return; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c index 20a76d81d532..76405a351111 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c @@ -1227,7 +1227,7 @@ int amdgpu_dm_check_crtc_color_mgmt(struct dm_crtc_state *crtc, crtc->cm_is_degamma_srgb = false; if (check_only) { - out_tf = kvzalloc(sizeof(*out_tf), GFP_KERNEL); + out_tf = kvzalloc_obj(*out_tf, GFP_KERNEL); if (!out_tf) return -ENOMEM; } else { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c index a2de3bba8346..2f072167bcc5 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c @@ -66,7 +66,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr memset(ops, 0, sizeof(ops)); /* 1D curve - DEGAM TF */ - ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); + ops[i] = kzalloc_obj(*ops[0], GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -83,7 +83,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr i++; /* Multiplier */ - ops[i] = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL); + ops[i] = kzalloc_obj(struct drm_colorop, GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -98,7 +98,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr i++; /* 3x4 matrix */ - ops[i] = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL); + ops[i] = kzalloc_obj(struct drm_colorop, GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -114,7 +114,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr if (adev->dm.dc->caps.color.dpp.hw_3d_lut) { /* 1D curve - SHAPER TF */ - ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); + ops[i] = kzalloc_obj(*ops[0], GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -131,7 +131,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr i++; /* 1D LUT - SHAPER LUT */ - ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); + ops[i] = kzalloc_obj(*ops[0], GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -148,7 +148,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr i++; /* 3D LUT */ - ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); + ops[i] = kzalloc_obj(*ops[0], GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -166,7 +166,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr } /* 1D curve - BLND TF */ - ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); + ops[i] = kzalloc_obj(*ops[0], GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; @@ -183,7 +183,7 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr i++; /* 1D LUT - BLND LUT */ - ops[i] = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL); + ops[i] = kzalloc_obj(struct drm_colorop, GFP_KERNEL); if (!ops[i]) { ret = -ENOMEM; goto cleanup; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c index 1b03f2bf8d7a..212f613fad1e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c @@ -958,9 +958,8 @@ void amdgpu_dm_crtc_secure_display_create_contexts(struct amdgpu_device *adev) struct secure_display_crtc_context *crtc_ctx = NULL; int i; - crtc_ctx = kcalloc(adev->mode_info.num_crtc, - sizeof(struct secure_display_crtc_context), - GFP_KERNEL); + crtc_ctx = kzalloc_objs(struct secure_display_crtc_context, + adev->mode_info.num_crtc, GFP_KERNEL); if (!crtc_ctx) { adev->dm.secure_display_ctx.crtc_ctx = NULL; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c index 9fcd72d87d25..49f68ddcfec8 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c @@ -231,7 +231,7 @@ struct idle_workqueue *idle_create_workqueue(struct amdgpu_device *adev) { struct idle_workqueue *idle_work; - idle_work = kzalloc(sizeof(*idle_work), GFP_KERNEL); + idle_work = kzalloc_obj(*idle_work, GFP_KERNEL); if (ZERO_OR_NULL_PTR(idle_work)) return NULL; @@ -392,7 +392,7 @@ static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable) return 0; if (dm->vblank_control_workqueue) { - work = kzalloc(sizeof(*work), GFP_ATOMIC); + work = kzalloc_obj(*work, GFP_ATOMIC); if (!work) return -ENOMEM; @@ -447,7 +447,7 @@ static struct drm_crtc_state *amdgpu_dm_crtc_duplicate_state(struct drm_crtc *cr if (WARN_ON(!crtc->state)) return NULL; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; @@ -487,7 +487,7 @@ static void amdgpu_dm_crtc_reset_state(struct drm_crtc *crtc) if (crtc->state) amdgpu_dm_crtc_destroy_state(crtc, crtc->state); - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (WARN_ON(!state)) return; @@ -728,14 +728,14 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm, bool has_degamma; int res = -ENOMEM; - cursor_plane = kzalloc(sizeof(*cursor_plane), GFP_KERNEL); + cursor_plane = kzalloc_obj(*cursor_plane, GFP_KERNEL); if (!cursor_plane) goto fail; cursor_plane->type = DRM_PLANE_TYPE_CURSOR; res = amdgpu_dm_plane_init(dm, cursor_plane, 0, NULL); - acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL); + acrtc = kzalloc_obj(struct amdgpu_crtc, GFP_KERNEL); if (!acrtc) goto fail; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index d6d43f1bf6d2..b43ec19848fd 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -4301,7 +4301,7 @@ static ssize_t dcc_en_bits_read( int *dcc_en_bits; int i, r; - dcc_en_bits = kcalloc(num_pipes, sizeof(int), GFP_KERNEL); + dcc_en_bits = kzalloc_objs(int, num_pipes, GFP_KERNEL); if (!dcc_en_bits) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c index a10401675f53..3b26797c9d03 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c @@ -746,7 +746,7 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct hdcp_workqueue *hdcp_work; int i = 0; - hdcp_work = kcalloc(max_caps, sizeof(*hdcp_work), GFP_KERNEL); + hdcp_work = kzalloc_objs(*hdcp_work, max_caps, GFP_KERNEL); if (ZERO_OR_NULL_PTR(hdcp_work)) return NULL; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index bf2a356b3475..d26003d2a2cc 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -617,7 +617,7 @@ bool dm_helpers_submit_i2c( return false; } - msgs = kcalloc(num, sizeof(struct i2c_msg), GFP_KERNEL); + msgs = kzalloc_objs(struct i2c_msg, num, GFP_KERNEL); if (!msgs) return false; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c index 5948e2a6219e..dfb80689d889 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c @@ -313,7 +313,7 @@ void *amdgpu_dm_irq_register_interrupt(struct amdgpu_device *adev, if (false == validate_irq_registration_params(int_params, ih)) return DAL_INVALID_IRQ_HANDLER_IDX; - handler_data = kzalloc(sizeof(*handler_data), GFP_KERNEL); + handler_data = kzalloc_obj(*handler_data, GFP_KERNEL); if (!handler_data) { DRM_ERROR("DM_IRQ: failed to allocate irq handler!\n"); return DAL_INVALID_IRQ_HANDLER_IDX; @@ -594,7 +594,7 @@ static void amdgpu_dm_irq_schedule_work(struct amdgpu_device *adev, handler_data = container_of(handler_list->next, struct amdgpu_dm_irq_handler_data, list); /*allocate a new amdgpu_dm_irq_handler_data*/ - handler_data_add = kzalloc(sizeof(*handler_data), GFP_ATOMIC); + handler_data_add = kzalloc_obj(*handler_data, GFP_ATOMIC); if (!handler_data_add) { DRM_ERROR("DM_IRQ: failed to allocate irq handler!\n"); return; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c index 5e92eaa67aa3..781163d6b23b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c @@ -640,7 +640,7 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, struct drm_connector *connector; int i; - aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); + aconnector = kzalloc_obj(*aconnector, GFP_KERNEL); if (!aconnector) return NULL; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c index 198064acf9f6..c50583a05ce3 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c @@ -1470,7 +1470,7 @@ static void amdgpu_dm_plane_drm_plane_reset(struct drm_plane *plane) if (plane->state) plane->funcs->atomic_destroy_state(plane, plane->state); - amdgpu_state = kzalloc(sizeof(*amdgpu_state), GFP_KERNEL); + amdgpu_state = kzalloc_obj(*amdgpu_state, GFP_KERNEL); WARN_ON(amdgpu_state == NULL); if (!amdgpu_state) @@ -1488,7 +1488,7 @@ static struct drm_plane_state *amdgpu_dm_plane_drm_plane_duplicate_state(struct struct dm_plane_state *dm_plane_state, *old_dm_plane_state; old_dm_plane_state = to_dm_plane_state(plane->state); - dm_plane_state = kzalloc(sizeof(*dm_plane_state), GFP_KERNEL); + dm_plane_state = kzalloc_obj(*dm_plane_state, GFP_KERNEL); if (!dm_plane_state) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c b/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c index 4da5adab799c..dbc4c2e0e514 100644 --- a/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c +++ b/drivers/gpu/drm/amd/display/dc/basics/dce_calcs.c @@ -120,19 +120,21 @@ static void calculate_bandwidth( int32_t number_of_displays_enabled_with_margin = 0; int32_t number_of_aligned_displays_with_no_margin = 0; - yclk = kcalloc(3, sizeof(*yclk), GFP_KERNEL); + yclk = kzalloc_objs(*yclk, 3, GFP_KERNEL); if (!yclk) return; - sclk = kcalloc(8, sizeof(*sclk), GFP_KERNEL); + sclk = kzalloc_objs(*sclk, 8, GFP_KERNEL); if (!sclk) goto free_yclk; - tiling_mode = kcalloc(maximum_number_of_surfaces, sizeof(*tiling_mode), GFP_KERNEL); + tiling_mode = kzalloc_objs(*tiling_mode, maximum_number_of_surfaces, + GFP_KERNEL); if (!tiling_mode) goto free_sclk; - surface_type = kcalloc(maximum_number_of_surfaces, sizeof(*surface_type), GFP_KERNEL); + surface_type = kzalloc_objs(*surface_type, maximum_number_of_surfaces, + GFP_KERNEL); if (!surface_type) goto free_tiling_mode; @@ -2049,11 +2051,11 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip, enum bw_calcs_version version = bw_calcs_version_from_asic_id(asic_id); - dceip = kzalloc(sizeof(*dceip), GFP_KERNEL); + dceip = kzalloc_obj(*dceip, GFP_KERNEL); if (!dceip) return; - vbios = kzalloc(sizeof(*vbios), GFP_KERNEL); + vbios = kzalloc_obj(*vbios, GFP_KERNEL); if (!vbios) { kfree(dceip); return; @@ -3045,8 +3047,8 @@ bool bw_calcs(struct dc_context *ctx, int pipe_count, struct dce_bw_output *calcs_output) { - struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data), - GFP_KERNEL); + struct bw_calcs_data *data = kzalloc_obj(struct bw_calcs_data, + GFP_KERNEL); if (!data) return false; diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c index b413a672c2c0..8f6b780b7778 100644 --- a/drivers/gpu/drm/amd/display/dc/basics/vector.c +++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c @@ -94,7 +94,7 @@ struct vector *dal_vector_presized_create( void *initial_value, uint32_t struct_size) { - struct vector *vector = kzalloc(sizeof(struct vector), GFP_KERNEL); + struct vector *vector = kzalloc_obj(struct vector, GFP_KERNEL); if (vector == NULL) return NULL; @@ -113,7 +113,7 @@ struct vector *dal_vector_create( uint32_t capacity, uint32_t struct_size) { - struct vector *vector = kzalloc(sizeof(struct vector), GFP_KERNEL); + struct vector *vector = kzalloc_obj(struct vector, GFP_KERNEL); if (vector == NULL) return NULL; 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 9f11e6ca4051..65993314c5cd 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c @@ -98,7 +98,7 @@ struct dc_bios *bios_parser_create( { struct bios_parser *bp; - bp = kzalloc(sizeof(struct bios_parser), GFP_KERNEL); + bp = kzalloc_obj(struct bios_parser, GFP_KERNEL); if (!bp) return NULL; @@ -2667,7 +2667,7 @@ static struct integrated_info *bios_parser_create_integrated_info( struct bios_parser *bp = BP_FROM_DCB(dcb); struct integrated_info *info; - info = kzalloc(sizeof(struct integrated_info), GFP_KERNEL); + info = kzalloc_obj(struct integrated_info, GFP_KERNEL); if (info == NULL) { ASSERT_CRITICAL(0); 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 550a9f1d03f8..9da95c59a68b 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -3207,7 +3207,7 @@ static struct integrated_info *bios_parser_create_integrated_info( struct bios_parser *bp = BP_FROM_DCB(dcb); struct integrated_info *info; - info = kzalloc(sizeof(struct integrated_info), GFP_KERNEL); + info = kzalloc_obj(struct integrated_info, GFP_KERNEL); if (info == NULL) { ASSERT_CRITICAL(0); @@ -3793,7 +3793,7 @@ struct dc_bios *firmware_parser_create( { struct bios_parser *bp; - bp = kzalloc(sizeof(struct bios_parser), GFP_KERNEL); + bp = kzalloc_obj(struct bios_parser, GFP_KERNEL); if (!bp) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c index 15cf13ec5302..451d596783e0 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c @@ -151,7 +151,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p switch (asic_id.chip_family) { #if defined(CONFIG_DRM_AMD_DC_SI) case FAMILY_SI: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -163,7 +164,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p #endif case FAMILY_CI: case FAMILY_KV: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -173,7 +175,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p return &clk_mgr->base; } case FAMILY_CZ: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -183,7 +186,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p return &clk_mgr->base; } case FAMILY_VI: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -207,7 +211,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p return &clk_mgr->base; } case FAMILY_AI: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -221,7 +226,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p } #if defined(CONFIG_DRM_AMD_DC_FP) case FAMILY_RV: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -249,7 +255,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p return &clk_mgr->base; } case FAMILY_NV: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -276,7 +283,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p } case FAMILY_VGH: if (ASICREV_IS_VANGOGH(asic_id.hw_internal_rev)) { - struct clk_mgr_vgh *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_vgh *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -288,7 +296,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p break; case FAMILY_YELLOW_CARP: { - struct clk_mgr_dcn31 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_dcn31 *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -300,7 +309,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p } break; case AMDGPU_FAMILY_GC_10_3_6: { - struct clk_mgr_dcn315 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_dcn315 *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -312,7 +322,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p } break; case AMDGPU_FAMILY_GC_10_3_7: { - struct clk_mgr_dcn316 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_dcn316 *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -324,7 +335,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p } break; case AMDGPU_FAMILY_GC_11_0_0: { - struct clk_mgr_internal *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_internal *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -335,7 +347,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p } case AMDGPU_FAMILY_GC_11_0_1: { - struct clk_mgr_dcn314 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_dcn314 *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); @@ -348,7 +361,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p break; case AMDGPU_FAMILY_GC_11_5_0: { - struct clk_mgr_dcn35 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); + struct clk_mgr_dcn35 *clk_mgr = kzalloc_obj(*clk_mgr, + GFP_KERNEL); if (clk_mgr == NULL) { BREAK_TO_DEBUGGER(); diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c index ef77fcd164ed..0684d2e68827 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c @@ -561,7 +561,8 @@ void dcn3_clk_mgr_construct( dce_clock_read_ss_info(clk_mgr); - clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL); + clk_mgr->base.bw_params = kzalloc_obj(*clk_mgr->base.bw_params, + GFP_KERNEL); if (!clk_mgr->base.bw_params) { BREAK_TO_DEBUGGER(); return; diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c index 7da7b41bd092..820656aef040 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c @@ -1206,7 +1206,8 @@ void dcn32_clk_mgr_construct( clk_mgr->smu_present = false; - clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL); + clk_mgr->base.bw_params = kzalloc_obj(*clk_mgr->base.bw_params, + GFP_KERNEL); if (!clk_mgr->base.bw_params) { BREAK_TO_DEBUGGER(); return; diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c index 306016c1f109..01c8e2dd64ed 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c @@ -1549,7 +1549,8 @@ struct clk_mgr_internal *dcn401_clk_mgr_construct( struct dccg *dccg) { struct clk_log_info log_info = {0}; - struct dcn401_clk_mgr *clk_mgr401 = kzalloc(sizeof(struct dcn401_clk_mgr), GFP_KERNEL); + struct dcn401_clk_mgr *clk_mgr401 = kzalloc_obj(struct dcn401_clk_mgr, + GFP_KERNEL); struct clk_mgr_internal *clk_mgr; if (!clk_mgr401) @@ -1599,7 +1600,8 @@ struct clk_mgr_internal *dcn401_clk_mgr_construct( clk_mgr->smu_present = false; - clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL); + clk_mgr->base.bw_params = kzalloc_obj(*clk_mgr->base.bw_params, + GFP_KERNEL); if (!clk_mgr->base.bw_params) { BREAK_TO_DEBUGGER(); kfree(clk_mgr401); diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 984b4bc5f53c..e05a6a9d66ff 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -284,7 +284,7 @@ static bool create_links( } for (i = 0; i < num_virtual_links; i++) { - struct dc_link *link = kzalloc(sizeof(*link), GFP_KERNEL); + struct dc_link *link = kzalloc_obj(*link, GFP_KERNEL); struct encoder_init_data enc_init = {0}; if (link == NULL) { @@ -304,7 +304,7 @@ static bool create_links( link->link_id.enum_id = ENUM_ID_1; link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED; link->replay_settings.config.replay_version = DC_REPLAY_VERSION_UNSUPPORTED; - link->link_enc = kzalloc(sizeof(*link->link_enc), GFP_KERNEL); + link->link_enc = kzalloc_obj(*link->link_enc, GFP_KERNEL); if (!link->link_enc) { BREAK_TO_DEBUGGER(); @@ -409,7 +409,7 @@ static void destroy_link_encoders(struct dc *dc) static struct dc_perf_trace *dc_perf_trace_create(void) { - return kzalloc(sizeof(struct dc_perf_trace), GFP_KERNEL); + return kzalloc_obj(struct dc_perf_trace, GFP_KERNEL); } static void dc_perf_trace_destroy(struct dc_perf_trace **perf_trace) @@ -1005,7 +1005,7 @@ static bool dc_construct_ctx(struct dc *dc, { struct dc_context *dc_ctx; - dc_ctx = kzalloc(sizeof(*dc_ctx), GFP_KERNEL); + dc_ctx = kzalloc_obj(*dc_ctx, GFP_KERNEL); if (!dc_ctx) return false; @@ -1023,7 +1023,7 @@ static bool dc_construct_ctx(struct dc *dc, dc_ctx->clk_reg_offsets = init_params->clk_reg_offsets; /* Create logger */ - dc_ctx->logger = kmalloc(sizeof(*dc_ctx->logger), GFP_KERNEL); + dc_ctx->logger = kmalloc_obj(*dc_ctx->logger, GFP_KERNEL); if (!dc_ctx->logger) { kfree(dc_ctx); @@ -1063,7 +1063,7 @@ static bool dc_construct(struct dc *dc, dc->config = init_params->flags; // Allocate memory for the vm_helper - dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL); + dc->vm_helper = kzalloc_obj(struct vm_helper, GFP_KERNEL); if (!dc->vm_helper) { dm_error("%s: failed to create dc->vm_helper\n", __func__); goto fail; @@ -1071,7 +1071,7 @@ static bool dc_construct(struct dc *dc, memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides)); - dc_dceip = kzalloc(sizeof(*dc_dceip), GFP_KERNEL); + dc_dceip = kzalloc_obj(*dc_dceip, GFP_KERNEL); if (!dc_dceip) { dm_error("%s: failed to create dceip\n", __func__); goto fail; @@ -1079,14 +1079,14 @@ static bool dc_construct(struct dc *dc, dc->bw_dceip = dc_dceip; - dc_vbios = kzalloc(sizeof(*dc_vbios), GFP_KERNEL); + dc_vbios = kzalloc_obj(*dc_vbios, GFP_KERNEL); if (!dc_vbios) { dm_error("%s: failed to create vbios\n", __func__); goto fail; } dc->bw_vbios = dc_vbios; - dcn_soc = kzalloc(sizeof(*dcn_soc), GFP_KERNEL); + dcn_soc = kzalloc_obj(*dcn_soc, GFP_KERNEL); if (!dcn_soc) { dm_error("%s: failed to create dcn_soc\n", __func__); goto fail; @@ -1094,7 +1094,7 @@ static bool dc_construct(struct dc *dc, dc->dcn_soc = dcn_soc; - dcn_ip = kzalloc(sizeof(*dcn_ip), GFP_KERNEL); + dcn_ip = kzalloc_obj(*dcn_ip, GFP_KERNEL); if (!dcn_ip) { dm_error("%s: failed to create dcn_ip\n", __func__); goto fail; @@ -1496,7 +1496,7 @@ static void disable_vbios_mode_if_required( struct dc *dc_create(const struct dc_init_data *init_params) { - struct dc *dc = kzalloc(sizeof(*dc), GFP_KERNEL); + struct dc *dc = kzalloc_obj(*dc, GFP_KERNEL); unsigned int full_pipe_count; if (!dc) @@ -2613,8 +2613,8 @@ bool dc_set_generic_gpio_for_stereo(bool enable, enum gpio_result gpio_result = GPIO_RESULT_NON_SPECIFIC_ERROR; struct gpio_pin_info pin_info; struct gpio *generic; - struct gpio_generic_mux_config *config = kzalloc(sizeof(struct gpio_generic_mux_config), - GFP_KERNEL); + struct gpio_generic_mux_config *config = kzalloc_obj(struct gpio_generic_mux_config, + GFP_KERNEL); if (!config) return false; 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 455fa5dd1420..0bcd7445fe97 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_sink.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_sink.c @@ -76,7 +76,7 @@ void dc_sink_release(struct dc_sink *sink) struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params) { - struct dc_sink *sink = kzalloc(sizeof(*sink), GFP_KERNEL); + struct dc_sink *sink = kzalloc_obj(*sink, GFP_KERNEL); if (NULL == sink) goto alloc_fail; diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_state.c b/drivers/gpu/drm/amd/display/dc/core/dc_state.c index 2de8ef4a58ec..c85b8915bbd3 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_state.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_state.c @@ -195,7 +195,7 @@ struct dc_state *dc_state_create(struct dc *dc, struct dc_state_create_params *p { struct dc_state *state; - state = kvzalloc(sizeof(struct dc_state), GFP_KERNEL); + state = kvzalloc_obj(struct dc_state, GFP_KERNEL); if (!state) return NULL; @@ -251,8 +251,7 @@ struct dc_state *dc_state_create_copy(struct dc_state *src_state) { struct dc_state *new_state; - new_state = kvmalloc(sizeof(struct dc_state), - GFP_KERNEL); + new_state = kvmalloc_obj(struct dc_state, GFP_KERNEL); if (!new_state) return NULL; 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 191f6435e7c6..def02e26cb1f 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c @@ -170,7 +170,7 @@ struct dc_stream_state *dc_create_stream_for_sink( if (sink == NULL) goto fail; - stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL); + stream = kzalloc_obj(struct dc_stream_state, GFP_KERNEL); if (stream == NULL) goto fail; 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 0971dfa25845..11c237720bd2 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c @@ -85,8 +85,8 @@ uint8_t dc_plane_get_pipe_mask(struct dc_state *dc_state, const struct dc_plane ******************************************************************************/ struct dc_plane_state *dc_create_plane_state(const struct dc *dc) { - struct dc_plane_state *plane_state = kvzalloc(sizeof(*plane_state), - GFP_ATOMIC); + struct dc_plane_state *plane_state = kvzalloc_obj(*plane_state, + GFP_ATOMIC); if (NULL == plane_state) return NULL; @@ -195,7 +195,7 @@ void dc_gamma_release(struct dc_gamma **gamma) struct dc_gamma *dc_create_gamma(void) { - struct dc_gamma *gamma = kvzalloc(sizeof(*gamma), GFP_KERNEL); + struct dc_gamma *gamma = kvzalloc_obj(*gamma, GFP_KERNEL); if (gamma == NULL) goto alloc_fail; @@ -225,7 +225,7 @@ void dc_transfer_func_release(struct dc_transfer_func *tf) struct dc_transfer_func *dc_create_transfer_func(void) { - struct dc_transfer_func *tf = kvzalloc(sizeof(*tf), GFP_KERNEL); + struct dc_transfer_func *tf = kvzalloc_obj(*tf, GFP_KERNEL); if (tf == NULL) goto alloc_fail; @@ -247,7 +247,7 @@ static void dc_3dlut_func_free(struct kref *kref) struct dc_3dlut *dc_create_3dlut_func(void) { - struct dc_3dlut *lut = kvzalloc(sizeof(*lut), GFP_KERNEL); + struct dc_3dlut *lut = kvzalloc_obj(*lut, GFP_KERNEL); if (lut == NULL) goto alloc_fail; diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c index e4dd5ca70987..9b70c4e96ffe 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -60,7 +60,7 @@ static void dc_dmub_srv_handle_failure(struct dc_dmub_srv *dc_dmub_srv) struct dc_dmub_srv *dc_dmub_srv_create(struct dc *dc, struct dmub_srv *dmub) { struct dc_dmub_srv *dc_srv = - kzalloc(sizeof(struct dc_dmub_srv), GFP_KERNEL); + kzalloc_obj(struct dc_dmub_srv, GFP_KERNEL); if (dc_srv == NULL) { BREAK_TO_DEBUGGER(); diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c index 733b85d450d9..7c578d10cbca 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn20/dcn20_dccg.c @@ -200,7 +200,7 @@ struct dccg *dccg2_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn201/dcn201_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn201/dcn201_dccg.c index 79d14ce19393..b147456a8cd4 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn201/dcn201_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn201/dcn201_dccg.c @@ -70,7 +70,7 @@ struct dccg *dccg201_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn21/dcn21_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn21/dcn21_dccg.c index b48dcafbae66..f14abe712f2d 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn21/dcn21_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn21/dcn21_dccg.c @@ -116,7 +116,7 @@ struct dccg *dccg21_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn30/dcn30_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn30/dcn30_dccg.c index adec7c3c2d49..f264cf2285ce 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn30/dcn30_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn30/dcn30_dccg.c @@ -62,7 +62,7 @@ struct dccg *dccg3_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { @@ -87,7 +87,7 @@ struct dccg *dccg30_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn301/dcn301_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn301/dcn301_dccg.c index fc9bddd94b50..93ff864def88 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn301/dcn301_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn301/dcn301_dccg.c @@ -61,7 +61,7 @@ struct dccg *dccg301_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c index c647dff5234a..5ab0325f3615 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn31/dcn31_dccg.c @@ -863,7 +863,7 @@ struct dccg *dccg31_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c index 2e9c4b13988a..5193883bfb41 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c @@ -392,7 +392,7 @@ struct dccg *dccg314_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c index ce697c3249fb..be44bc057bee 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn32/dcn32_dccg.c @@ -360,7 +360,7 @@ struct dccg *dccg32_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c index 943ec1983076..34414be7efb6 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c @@ -2461,7 +2461,7 @@ struct dccg *dccg35_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c b/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c index f1d394560892..9554d24b882b 100644 --- a/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c @@ -892,7 +892,7 @@ struct dccg *dccg401_create( const struct dccg_shift *dccg_shift, const struct dccg_mask *dccg_mask) { - struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); + struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn, GFP_KERNEL); struct dccg *base; if (dccg_dcn == NULL) { 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 2dcf394edf22..71bb5794a513 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c @@ -283,7 +283,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 = kzalloc(sizeof(*abm_dce), GFP_KERNEL); + struct dce_abm *abm_dce = kzalloc_obj(*abm_dce, GFP_KERNEL); if (abm_dce == NULL) { BREAK_TO_DEBUGGER(); 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 fcad61c618a1..ba30394b828f 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c @@ -1331,7 +1331,7 @@ struct audio *dce_audio_create( const struct dce_audio_mask *masks ) { - struct dce_audio *audio = kzalloc(sizeof(*audio), GFP_KERNEL); + struct dce_audio *audio = kzalloc_obj(*audio, GFP_KERNEL); if (audio == NULL) { ASSERT_CRITICAL(audio); @@ -1357,7 +1357,7 @@ struct audio *dce60_audio_create( const struct dce_audio_mask *masks ) { - struct dce_audio *audio = kzalloc(sizeof(*audio), GFP_KERNEL); + struct dce_audio *audio = kzalloc_obj(*audio, GFP_KERNEL); if (audio == NULL) { ASSERT_CRITICAL(audio); diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c index e7acd6eec1fd..405758106101 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clk_mgr.c @@ -848,7 +848,7 @@ struct clk_mgr *dce_clk_mgr_create( const struct clk_mgr_shift *clk_shift, const struct clk_mgr_mask *clk_mask) { - struct dce_clk_mgr *clk_mgr_dce = kzalloc(sizeof(*clk_mgr_dce), GFP_KERNEL); + struct dce_clk_mgr *clk_mgr_dce = kzalloc_obj(*clk_mgr_dce, GFP_KERNEL); if (clk_mgr_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -871,7 +871,7 @@ struct clk_mgr *dce110_clk_mgr_create( const struct clk_mgr_shift *clk_shift, const struct clk_mgr_mask *clk_mask) { - struct dce_clk_mgr *clk_mgr_dce = kzalloc(sizeof(*clk_mgr_dce), GFP_KERNEL); + struct dce_clk_mgr *clk_mgr_dce = kzalloc_obj(*clk_mgr_dce, GFP_KERNEL); if (clk_mgr_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -896,7 +896,7 @@ struct clk_mgr *dce112_clk_mgr_create( const struct clk_mgr_shift *clk_shift, const struct clk_mgr_mask *clk_mask) { - struct dce_clk_mgr *clk_mgr_dce = kzalloc(sizeof(*clk_mgr_dce), GFP_KERNEL); + struct dce_clk_mgr *clk_mgr_dce = kzalloc_obj(*clk_mgr_dce, GFP_KERNEL); if (clk_mgr_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -917,7 +917,7 @@ struct clk_mgr *dce112_clk_mgr_create( struct clk_mgr *dce120_clk_mgr_create(struct dc_context *ctx) { - struct dce_clk_mgr *clk_mgr_dce = kzalloc(sizeof(*clk_mgr_dce), GFP_KERNEL); + struct dce_clk_mgr *clk_mgr_dce = kzalloc_obj(*clk_mgr_dce, GFP_KERNEL); if (clk_mgr_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -939,8 +939,7 @@ struct clk_mgr *dce120_clk_mgr_create(struct dc_context *ctx) struct clk_mgr *dce121_clk_mgr_create(struct dc_context *ctx) { - struct dce_clk_mgr *clk_mgr_dce = kzalloc(sizeof(*clk_mgr_dce), - GFP_KERNEL); + struct dce_clk_mgr *clk_mgr_dce = kzalloc_obj(*clk_mgr_dce, GFP_KERNEL); if (clk_mgr_dce == NULL) { BREAK_TO_DEBUGGER(); 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 b4f5b4a6331a..2b242df1b952 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 @@ -1476,16 +1476,14 @@ static void get_ss_info_from_atombios( if (*ss_entries_num == 0) return; - ss_info = kcalloc(*ss_entries_num, - sizeof(struct spread_spectrum_info), - GFP_KERNEL); + ss_info = kzalloc_objs(struct spread_spectrum_info, *ss_entries_num, + GFP_KERNEL); ss_info_cur = ss_info; if (ss_info == NULL) return; - ss_data = kcalloc(*ss_entries_num, - sizeof(struct spread_spectrum_data), - GFP_KERNEL); + ss_data = kzalloc_objs(struct spread_spectrum_data, *ss_entries_num, + GFP_KERNEL); if (ss_data == NULL) goto out_free_info; 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 5f8fba45d98d..dd33218dcbab 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c @@ -1105,7 +1105,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 = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL); + struct dce_dmcu *dmcu_dce = kzalloc_obj(*dmcu_dce, GFP_KERNEL); if (dmcu_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -1126,7 +1126,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 = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL); + struct dce_dmcu *dmcu_dce = kzalloc_obj(*dmcu_dce, GFP_KERNEL); if (dmcu_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -1147,7 +1147,7 @@ struct dmcu *dcn20_dmcu_create( const struct dce_dmcu_shift *dmcu_shift, const struct dce_dmcu_mask *dmcu_mask) { - struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL); + struct dce_dmcu *dmcu_dce = kzalloc_obj(*dmcu_dce, GFP_KERNEL); if (dmcu_dce == NULL) { BREAK_TO_DEBUGGER(); @@ -1168,7 +1168,7 @@ struct dmcu *dcn21_dmcu_create( const struct dce_dmcu_shift *dmcu_shift, const struct dce_dmcu_mask *dmcu_mask) { - struct dce_dmcu *dmcu_dce = kzalloc(sizeof(*dmcu_dce), GFP_KERNEL); + struct dce_dmcu *dmcu_dce = kzalloc_obj(*dmcu_dce, GFP_KERNEL); if (dmcu_dce == NULL) { BREAK_TO_DEBUGGER(); diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c index 3b9011ef9b68..11ba6e59f5b5 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c @@ -222,7 +222,7 @@ struct abm *dmub_abm_create( const struct dce_abm_mask *abm_mask) { if (ctx->dc->caps.dmcub_support) { - struct dce_abm *abm_dce = kzalloc(sizeof(*abm_dce), GFP_KERNEL); + struct dce_abm *abm_dce = kzalloc_obj(*abm_dce, GFP_KERNEL); if (abm_dce == NULL) { BREAK_TO_DEBUGGER(); diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c index 87af4fdc04a6..4527e35a0666 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c @@ -488,7 +488,7 @@ static void dmub_psr_construct(struct dmub_psr *psr, struct dc_context *ctx) */ struct dmub_psr *dmub_psr_create(struct dc_context *ctx) { - struct dmub_psr *psr = kzalloc(sizeof(struct dmub_psr), GFP_KERNEL); + struct dmub_psr *psr = kzalloc_obj(struct dmub_psr, GFP_KERNEL); if (psr == NULL) { BREAK_TO_DEBUGGER(); diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c index fd8244c94687..c590c9274f21 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c @@ -438,7 +438,7 @@ static void dmub_replay_construct(struct dmub_replay *replay, struct dc_context */ struct dmub_replay *dmub_replay_create(struct dc_context *ctx) { - struct dmub_replay *replay = kzalloc(sizeof(struct dmub_replay), GFP_KERNEL); + struct dmub_replay *replay = kzalloc_obj(struct dmub_replay, GFP_KERNEL); if (replay == NULL) { BREAK_TO_DEBUGGER(); 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 59a0961b49da..68849d518e76 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_compressor.c @@ -394,7 +394,7 @@ void dce110_compressor_set_fbc_invalidation_triggers( struct compressor *dce110_compressor_create(struct dc_context *ctx) { struct dce110_compressor *cp110 = - kzalloc(sizeof(struct dce110_compressor), GFP_KERNEL); + kzalloc_obj(struct dce110_compressor, GFP_KERNEL); if (!cp110) 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 faae12cf7968..24effd7d3ea3 100644 --- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c +++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_compressor.c @@ -831,7 +831,7 @@ void dce112_compressor_construct(struct dce112_compressor *compressor, struct compressor *dce112_compressor_create(struct dc_context *ctx) { struct dce112_compressor *cp110 = - kzalloc(sizeof(struct dce112_compressor), GFP_KERNEL); + kzalloc_obj(struct dce112_compressor, GFP_KERNEL); if (!cp110) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/dio/virtual/virtual_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dio/virtual/virtual_stream_encoder.c index c5d2e9404d94..f30eeda44842 100644 --- a/drivers/gpu/drm/amd/display/dc/dio/virtual/virtual_stream_encoder.c +++ b/drivers/gpu/drm/amd/display/dc/dio/virtual/virtual_stream_encoder.c @@ -159,7 +159,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 = kzalloc(sizeof(*enc), GFP_KERNEL); + struct stream_encoder *enc = kzalloc_obj(*enc, GFP_KERNEL); if (!enc) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/dwb/dcn30/dcn30_dwb_cm.c b/drivers/gpu/drm/amd/display/dc/dwb/dcn30/dcn30_dwb_cm.c index 03a50c32fcfe..c4b1a337ac92 100644 --- a/drivers/gpu/drm/amd/display/dc/dwb/dcn30/dcn30_dwb_cm.c +++ b/drivers/gpu/drm/amd/display/dc/dwb/dcn30/dcn30_dwb_cm.c @@ -280,7 +280,7 @@ bool dwb3_ogam_set_input_transfer_func( if (in_transfer_func_dwb_ogam == NULL) return result; - dwb_ogam_lut = kzalloc(sizeof(*dwb_ogam_lut), GFP_KERNEL); + dwb_ogam_lut = kzalloc_obj(*dwb_ogam_lut, GFP_KERNEL); if (dwb_ogam_lut) { cm_helper_translate_curve_to_hw_format(dwbc->ctx, 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 8183cdf517b8..4e3a5b3513d8 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_base.c @@ -270,7 +270,7 @@ struct gpio *dal_gpio_create( uint32_t en, enum gpio_pin_output_state output_state) { - struct gpio *gpio = kzalloc(sizeof(struct gpio), GFP_KERNEL); + struct gpio *gpio = kzalloc_obj(struct gpio, GFP_KERNEL); if (!gpio) { ASSERT_CRITICAL(false); 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 942d9f0b6df2..fd7be0a35d0f 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c @@ -58,7 +58,7 @@ struct gpio_service *dal_gpio_service_create( struct gpio_service *service; int32_t index_of_id; - service = kzalloc(sizeof(struct gpio_service), GFP_KERNEL); + service = kzalloc_obj(struct gpio_service, GFP_KERNEL); if (!service) { BREAK_TO_DEBUGGER(); @@ -498,7 +498,7 @@ struct ddc *dal_gpio_create_ddc( if (!service->translate.funcs->offset_to_id(offset, mask, &id, &en)) return NULL; - ddc = kzalloc(sizeof(struct ddc), GFP_KERNEL); + ddc = kzalloc_obj(struct ddc, GFP_KERNEL); if (!ddc) { BREAK_TO_DEBUGGER(); 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 d9e6e70dc394..05fa4119bf55 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c @@ -233,7 +233,7 @@ void dal_hw_ddc_init( *hw_ddc = NULL; } - *hw_ddc = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL); + *hw_ddc = kzalloc_obj(struct hw_ddc, GFP_KERNEL); if (!*hw_ddc) { ASSERT_CRITICAL(false); return; diff --git a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c index 6cd50232c432..61bbcade18cb 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_generic.c @@ -111,7 +111,7 @@ void dal_hw_generic_init( *hw_generic = NULL; } - *hw_generic = kzalloc(sizeof(struct hw_generic), GFP_KERNEL); + *hw_generic = kzalloc_obj(struct hw_generic, GFP_KERNEL); if (!*hw_generic) { ASSERT_CRITICAL(false); return; 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 01ec451004f7..ee7d794a8c60 100644 --- a/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c +++ b/drivers/gpu/drm/amd/display/dc/gpio/hw_hpd.c @@ -132,7 +132,7 @@ void dal_hw_hpd_init( *hw_hpd = NULL; } - *hw_hpd = kzalloc(sizeof(struct hw_hpd), GFP_KERNEL); + *hw_hpd = kzalloc_obj(struct hw_hpd, GFP_KERNEL); if (!*hw_hpd) { ASSERT_CRITICAL(false); return; diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c index 5243177c1faa..7083c57da007 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c @@ -2399,7 +2399,7 @@ static int dcn10_align_pixel_clocks(struct dc *dc, int group_size, DC_LOGGER_INIT(dc_ctx->logger); - hw_crtc_timing = kcalloc(MAX_PIPES, sizeof(*hw_crtc_timing), GFP_KERNEL); + hw_crtc_timing = kzalloc_objs(*hw_crtc_timing, MAX_PIPES, GFP_KERNEL); if (!hw_crtc_timing) return master; 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 bb576a9c5fdb..002210b6bb62 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 @@ -419,8 +419,7 @@ static void dce110_irq_construct(struct irq_service *irq_service, struct irq_service * dal_irq_service_dce110_create(struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!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 33ce470e4c88..47714407252d 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 @@ -257,8 +257,7 @@ static void dce120_irq_construct( struct irq_service *dal_irq_service_dce120_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dce60/irq_service_dce60.c b/drivers/gpu/drm/amd/display/dc/irq/dce60/irq_service_dce60.c index d777b85e70da..47a2a53979db 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dce60/irq_service_dce60.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dce60/irq_service_dce60.c @@ -355,8 +355,7 @@ static void dce60_irq_construct( struct irq_service *dal_irq_service_dce60_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!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 3a9163acb49b..bad0e02713f8 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 @@ -267,8 +267,7 @@ static void dce80_irq_construct( struct irq_service *dal_irq_service_dce80_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!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 4ce9edd16344..51f3a5042788 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 @@ -369,8 +369,7 @@ static void dcn10_irq_construct( struct irq_service *dal_irq_service_dcn10_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c index 5847af0e66cb..cd09fa6e6706 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn20/irq_service_dcn20.c @@ -374,8 +374,7 @@ static void dcn20_irq_construct( struct irq_service *dal_irq_service_dcn20_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn201/irq_service_dcn201.c b/drivers/gpu/drm/amd/display/dc/irq/dcn201/irq_service_dcn201.c index 6417011d2246..7ca085b418e3 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn201/irq_service_dcn201.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn201/irq_service_dcn201.c @@ -328,8 +328,7 @@ static void dcn201_irq_construct( struct irq_service *dal_irq_service_dcn201_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c index 71d2f065140b..67fbcce3409f 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c @@ -402,8 +402,7 @@ static void dcn21_irq_construct( struct irq_service *dal_irq_service_dcn21_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn30/irq_service_dcn30.c b/drivers/gpu/drm/amd/display/dc/irq/dcn30/irq_service_dcn30.c index 2a4080bdcf6b..10a16dc17487 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn30/irq_service_dcn30.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn30/irq_service_dcn30.c @@ -411,8 +411,7 @@ static void dcn30_irq_construct( struct irq_service *dal_irq_service_dcn30_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn302/irq_service_dcn302.c b/drivers/gpu/drm/amd/display/dc/irq/dcn302/irq_service_dcn302.c index 624f1ac309f8..55c863790402 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn302/irq_service_dcn302.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn302/irq_service_dcn302.c @@ -377,7 +377,7 @@ static void dcn302_irq_construct(struct irq_service *irq_service, struct irq_ser struct irq_service *dal_irq_service_dcn302_create(struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn303/irq_service_dcn303.c b/drivers/gpu/drm/amd/display/dc/irq/dcn303/irq_service_dcn303.c index 137caffae916..2ce7c829a445 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn303/irq_service_dcn303.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn303/irq_service_dcn303.c @@ -273,7 +273,7 @@ static void dcn303_irq_construct(struct irq_service *irq_service, struct irq_ser struct irq_service *dal_irq_service_dcn303_create(struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn31/irq_service_dcn31.c b/drivers/gpu/drm/amd/display/dc/irq/dcn31/irq_service_dcn31.c index 921cb167d920..710cda204bee 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn31/irq_service_dcn31.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn31/irq_service_dcn31.c @@ -393,8 +393,7 @@ static void dcn31_irq_construct( struct irq_service *dal_irq_service_dcn31_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c b/drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c index 0118fd6e5db0..8cb120a3ceb7 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn314/irq_service_dcn314.c @@ -395,8 +395,7 @@ static void dcn314_irq_construct( struct irq_service *dal_irq_service_dcn314_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c b/drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c index adebfc888618..f3a0f8f176d8 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn315/irq_service_dcn315.c @@ -400,8 +400,7 @@ static void dcn315_irq_construct( struct irq_service *dal_irq_service_dcn315_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c b/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c index e9e315c75d76..80b388ac3511 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn32/irq_service_dcn32.c @@ -425,8 +425,7 @@ static void dcn32_irq_construct( struct irq_service *dal_irq_service_dcn32_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn35/irq_service_dcn35.c b/drivers/gpu/drm/amd/display/dc/irq/dcn35/irq_service_dcn35.c index 79e5e8c137ca..44b3c3b0c657 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn35/irq_service_dcn35.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn35/irq_service_dcn35.c @@ -389,8 +389,7 @@ static void dcn35_irq_construct( struct irq_service *dal_irq_service_dcn35_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn351/irq_service_dcn351.c b/drivers/gpu/drm/amd/display/dc/irq/dcn351/irq_service_dcn351.c index 163b8ee9ebf7..e4600282cf18 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn351/irq_service_dcn351.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn351/irq_service_dcn351.c @@ -371,8 +371,7 @@ static void dcn351_irq_construct( struct irq_service *dal_irq_service_dcn351_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn36/irq_service_dcn36.c b/drivers/gpu/drm/amd/display/dc/irq/dcn36/irq_service_dcn36.c index f716ab0fd30e..e81077f764df 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn36/irq_service_dcn36.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn36/irq_service_dcn36.c @@ -370,8 +370,7 @@ static void dcn36_irq_construct( struct irq_service *dal_irq_service_dcn36_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/irq/dcn401/irq_service_dcn401.c b/drivers/gpu/drm/amd/display/dc/irq/dcn401/irq_service_dcn401.c index fd9bb1950c20..97c80aa30e8b 100644 --- a/drivers/gpu/drm/amd/display/dc/irq/dcn401/irq_service_dcn401.c +++ b/drivers/gpu/drm/amd/display/dc/irq/dcn401/irq_service_dcn401.c @@ -403,8 +403,7 @@ static void dcn401_irq_construct( struct irq_service *dal_irq_service_dcn401_create( struct irq_service_init_data *init_data) { - struct irq_service *irq_service = kzalloc(sizeof(*irq_service), - GFP_KERNEL); + struct irq_service *irq_service = kzalloc_obj(*irq_service, GFP_KERNEL); if (!irq_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/link/link_factory.c b/drivers/gpu/drm/amd/display/dc/link/link_factory.c index 49db8123f08c..e1cf56cdc8c0 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_factory.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_factory.c @@ -302,7 +302,7 @@ static void construct_link_service(struct link_service *link_srv) struct link_service *link_create_link_service(void) { - struct link_service *link_srv = kzalloc(sizeof(*link_srv), GFP_KERNEL); + struct link_service *link_srv = kzalloc_obj(*link_srv, GFP_KERNEL); if (link_srv == NULL) goto fail; @@ -897,8 +897,7 @@ static bool link_construct(struct dc_link *link, struct dc_link *link_create(const struct link_init_data *init_params) { - struct dc_link *link = - kzalloc(sizeof(*link), GFP_KERNEL); + struct dc_link *link = kzalloc_obj(*link, GFP_KERNEL); if (NULL == link) goto alloc_fail; diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c index 5d2bcce2f669..1a7c73263615 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c @@ -156,7 +156,7 @@ struct ddc_service *link_create_ddc_service( { struct ddc_service *ddc_service; - ddc_service = kzalloc(sizeof(struct ddc_service), GFP_KERNEL); + ddc_service = kzalloc_obj(struct ddc_service, GFP_KERNEL); if (!ddc_service) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c b/drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c index 72bd43f9bbe2..0df983c70ba3 100644 --- a/drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c +++ b/drivers/gpu/drm/amd/display/dc/pg/dcn35/dcn35_pg_cntl.c @@ -542,7 +542,7 @@ struct pg_cntl *pg_cntl35_create( const struct pg_cntl_shift *pg_cntl_shift, const struct pg_cntl_mask *pg_cntl_mask) { - struct dcn_pg_cntl *pg_cntl_dcn = kzalloc(sizeof(*pg_cntl_dcn), GFP_KERNEL); + struct dcn_pg_cntl *pg_cntl_dcn = kzalloc_obj(*pg_cntl_dcn, GFP_KERNEL); struct pg_cntl *base; if (pg_cntl_dcn == NULL) { diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c index 05f7ff60f8f5..e562c71fb432 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dce100/dce100_resource.c @@ -472,7 +472,7 @@ static struct timing_generator *dce100_timing_generator_create( const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = - kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); + kzalloc_obj(struct dce110_timing_generator, GFP_KERNEL); if (!tg110) return NULL; @@ -486,7 +486,7 @@ static struct stream_encoder *dce100_stream_encoder_create( struct dc_context *ctx) { struct dce110_stream_encoder *enc110 = - kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_stream_encoder, GFP_KERNEL); if (!enc110) return NULL; @@ -520,7 +520,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dce100_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -573,8 +573,8 @@ static struct mem_input *dce100_mem_input_create( struct dc_context *ctx, uint32_t inst) { - struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input), - GFP_KERNEL); + struct dce_mem_input *dce_mi = kzalloc_obj(struct dce_mem_input, + GFP_KERNEL); if (!dce_mi) { BREAK_TO_DEBUGGER(); @@ -597,7 +597,7 @@ static struct transform *dce100_transform_create( uint32_t inst) { struct dce_transform *transform = - kzalloc(sizeof(struct dce_transform), GFP_KERNEL); + kzalloc_obj(struct dce_transform, GFP_KERNEL); if (!transform) return NULL; @@ -610,7 +610,7 @@ static struct transform *dce100_transform_create( static struct input_pixel_processor *dce100_ipp_create( struct dc_context *ctx, uint32_t inst) { - struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL); + struct dce_ipp *ipp = kzalloc_obj(struct dce_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -634,7 +634,7 @@ static struct link_encoder *dce100_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = - kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc110) @@ -669,7 +669,7 @@ static struct link_encoder *dce100_link_encoder_create( static struct panel_cntl *dce100_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -688,7 +688,7 @@ static struct output_pixel_processor *dce100_opp_create( uint32_t inst) { struct dce110_opp *opp = - kzalloc(sizeof(struct dce110_opp), GFP_KERNEL); + kzalloc_obj(struct dce110_opp, GFP_KERNEL); if (!opp) return NULL; @@ -703,7 +703,7 @@ static struct dce_aux *dce100_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -741,7 +741,7 @@ static struct dce_i2c_hw *dce100_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -759,7 +759,7 @@ static struct clock_source *dce100_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -1215,7 +1215,7 @@ struct resource_pool *dce100_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c index 7c09825cd9bd..68964e8ce10b 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c @@ -516,7 +516,7 @@ static struct timing_generator *dce110_timing_generator_create( const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = - kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); + kzalloc_obj(struct dce110_timing_generator, GFP_KERNEL); if (!tg110) return NULL; @@ -530,7 +530,7 @@ static struct stream_encoder *dce110_stream_encoder_create( struct dc_context *ctx) { struct dce110_stream_encoder *enc110 = - kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_stream_encoder, GFP_KERNEL); if (!enc110) return NULL; @@ -563,7 +563,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dce110_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -608,8 +608,8 @@ static struct mem_input *dce110_mem_input_create( struct dc_context *ctx, uint32_t inst) { - struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input), - GFP_KERNEL); + struct dce_mem_input *dce_mi = kzalloc_obj(struct dce_mem_input, + GFP_KERNEL); if (!dce_mi) { BREAK_TO_DEBUGGER(); @@ -632,7 +632,7 @@ static struct transform *dce110_transform_create( uint32_t inst) { struct dce_transform *transform = - kzalloc(sizeof(struct dce_transform), GFP_KERNEL); + kzalloc_obj(struct dce_transform, GFP_KERNEL); if (!transform) return NULL; @@ -645,7 +645,7 @@ static struct transform *dce110_transform_create( static struct input_pixel_processor *dce110_ipp_create( struct dc_context *ctx, uint32_t inst) { - struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL); + struct dce_ipp *ipp = kzalloc_obj(struct dce_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -669,7 +669,7 @@ static struct link_encoder *dce110_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = - kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -690,7 +690,7 @@ static struct link_encoder *dce110_link_encoder_create( static struct panel_cntl *dce110_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -709,7 +709,7 @@ static struct output_pixel_processor *dce110_opp_create( uint32_t inst) { struct dce110_opp *opp = - kzalloc(sizeof(struct dce110_opp), GFP_KERNEL); + kzalloc_obj(struct dce110_opp, GFP_KERNEL); if (!opp) return NULL; @@ -724,7 +724,7 @@ static struct dce_aux *dce110_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -762,7 +762,7 @@ static struct dce_i2c_hw *dce110_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -780,7 +780,7 @@ static struct clock_source *dce110_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -1250,14 +1250,12 @@ 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 = 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); + struct dce110_timing_generator *dce110_tgv = kzalloc_obj(*dce110_tgv, + GFP_KERNEL); + struct dce_transform *dce110_xfmv = kzalloc_obj(*dce110_xfmv, + GFP_KERNEL); + struct dce_mem_input *dce110_miv = kzalloc_obj(*dce110_miv, GFP_KERNEL); + struct dce110_opp *dce110_oppv = kzalloc_obj(*dce110_oppv, GFP_KERNEL); if (!dce110_tgv || !dce110_xfmv || !dce110_miv || !dce110_oppv) { kfree(dce110_tgv); @@ -1545,7 +1543,7 @@ struct resource_pool *dce110_create_resource_pool( struct hw_asic_id asic_id) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c index 3f0a6bc4dcc2..9c3f6e96f0ae 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dce112/dce112_resource.c @@ -497,7 +497,7 @@ static struct timing_generator *dce112_timing_generator_create( const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = - kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); + kzalloc_obj(struct dce110_timing_generator, GFP_KERNEL); if (!tg110) return NULL; @@ -511,7 +511,7 @@ static struct stream_encoder *dce112_stream_encoder_create( struct dc_context *ctx) { struct dce110_stream_encoder *enc110 = - kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_stream_encoder, GFP_KERNEL); if (!enc110) return NULL; @@ -540,7 +540,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dce112_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -580,8 +580,8 @@ static struct mem_input *dce112_mem_input_create( struct dc_context *ctx, uint32_t inst) { - struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input), - GFP_KERNEL); + struct dce_mem_input *dce_mi = kzalloc_obj(struct dce_mem_input, + GFP_KERNEL); if (!dce_mi) { BREAK_TO_DEBUGGER(); @@ -603,7 +603,7 @@ static struct transform *dce112_transform_create( uint32_t inst) { struct dce_transform *transform = - kzalloc(sizeof(struct dce_transform), GFP_KERNEL); + kzalloc_obj(struct dce_transform, GFP_KERNEL); if (!transform) return NULL; @@ -630,7 +630,7 @@ static struct link_encoder *dce112_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = - kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -651,7 +651,7 @@ static struct link_encoder *dce112_link_encoder_create( static struct panel_cntl *dce112_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -668,7 +668,7 @@ static struct panel_cntl *dce112_panel_cntl_create(const struct panel_cntl_init_ static struct input_pixel_processor *dce112_ipp_create( struct dc_context *ctx, uint32_t inst) { - struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL); + struct dce_ipp *ipp = kzalloc_obj(struct dce_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -685,7 +685,7 @@ static struct output_pixel_processor *dce112_opp_create( uint32_t inst) { struct dce110_opp *opp = - kzalloc(sizeof(struct dce110_opp), GFP_KERNEL); + kzalloc_obj(struct dce110_opp, GFP_KERNEL); if (!opp) return NULL; @@ -700,7 +700,7 @@ static struct dce_aux *dce112_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -738,7 +738,7 @@ static struct dce_i2c_hw *dce112_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -756,7 +756,7 @@ static struct clock_source *dce112_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -1423,7 +1423,7 @@ struct resource_pool *dce112_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c index 92890784caa6..48f8a418f324 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dce120/dce120_resource.c @@ -428,7 +428,7 @@ static struct output_pixel_processor *dce120_opp_create( uint32_t inst) { struct dce110_opp *opp = - kzalloc(sizeof(struct dce110_opp), GFP_KERNEL); + kzalloc_obj(struct dce110_opp, GFP_KERNEL); if (!opp) return NULL; @@ -442,7 +442,7 @@ static struct dce_aux *dce120_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -480,7 +480,7 @@ static struct dce_i2c_hw *dce120_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -541,8 +541,7 @@ static struct clock_source *dce120_clock_source_create( const struct dce110_clk_src_regs *regs, bool dp_clk_src) { - struct dce110_clk_src *clk_src = - kzalloc(sizeof(*clk_src), GFP_KERNEL); + struct dce110_clk_src *clk_src = kzalloc_obj(*clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -583,7 +582,7 @@ static struct timing_generator *dce120_timing_generator_create( const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = - kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); + kzalloc_obj(struct dce110_timing_generator, GFP_KERNEL); if (!tg110) return NULL; @@ -714,7 +713,7 @@ static struct link_encoder *dce120_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = - kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc110 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -736,7 +735,7 @@ static struct link_encoder *dce120_link_encoder_create( static struct panel_cntl *dce120_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -753,7 +752,7 @@ static struct panel_cntl *dce120_panel_cntl_create(const struct panel_cntl_init_ static struct input_pixel_processor *dce120_ipp_create( struct dc_context *ctx, uint32_t inst) { - struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL); + struct dce_ipp *ipp = kzalloc_obj(struct dce_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -770,7 +769,7 @@ static struct stream_encoder *dce120_stream_encoder_create( struct dc_context *ctx) { struct dce110_stream_encoder *enc110 = - kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_stream_encoder, GFP_KERNEL); if (!enc110) return NULL; @@ -813,7 +812,7 @@ static const struct dce_hwseq_mask dce121_hwseq_mask = { static struct dce_hwseq *dce120_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -827,7 +826,7 @@ static struct dce_hwseq *dce120_hwseq_create( static struct dce_hwseq *dce121_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -875,8 +874,8 @@ static struct mem_input *dce120_mem_input_create( struct dc_context *ctx, uint32_t inst) { - struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input), - GFP_KERNEL); + struct dce_mem_input *dce_mi = kzalloc_obj(struct dce_mem_input, + GFP_KERNEL); if (!dce_mi) { BREAK_TO_DEBUGGER(); @@ -892,7 +891,7 @@ static struct transform *dce120_transform_create( uint32_t inst) { struct dce_transform *transform = - kzalloc(sizeof(struct dce_transform), GFP_KERNEL); + kzalloc_obj(struct dce_transform, GFP_KERNEL); if (!transform) return NULL; @@ -1296,7 +1295,7 @@ struct resource_pool *dce120_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c index 8d810d5c8781..621739d0b024 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c @@ -507,7 +507,7 @@ static struct timing_generator *dce60_timing_generator_create( const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = - kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); + kzalloc_obj(struct dce110_timing_generator, GFP_KERNEL); if (!tg110) return NULL; @@ -521,7 +521,7 @@ static struct output_pixel_processor *dce60_opp_create( uint32_t inst) { struct dce110_opp *opp = - kzalloc(sizeof(struct dce110_opp), GFP_KERNEL); + kzalloc_obj(struct dce110_opp, GFP_KERNEL); if (!opp) return NULL; @@ -536,7 +536,7 @@ static struct dce_aux *dce60_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -574,7 +574,7 @@ static struct dce_i2c_hw *dce60_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -589,7 +589,7 @@ static struct dce_i2c_sw *dce60_i2c_sw_create( struct dc_context *ctx) { struct dce_i2c_sw *dce_i2c_sw = - kzalloc(sizeof(struct dce_i2c_sw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_sw, GFP_KERNEL); if (!dce_i2c_sw) return NULL; @@ -603,7 +603,7 @@ static struct stream_encoder *dce60_stream_encoder_create( struct dc_context *ctx) { struct dce110_stream_encoder *enc110 = - kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_stream_encoder, GFP_KERNEL); if (!enc110) return NULL; @@ -638,7 +638,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dce60_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -683,8 +683,8 @@ static struct mem_input *dce60_mem_input_create( struct dc_context *ctx, uint32_t inst) { - struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input), - GFP_KERNEL); + struct dce_mem_input *dce_mi = kzalloc_obj(struct dce_mem_input, + GFP_KERNEL); if (!dce_mi) { BREAK_TO_DEBUGGER(); @@ -707,7 +707,7 @@ static struct transform *dce60_transform_create( uint32_t inst) { struct dce_transform *transform = - kzalloc(sizeof(struct dce_transform), GFP_KERNEL); + kzalloc_obj(struct dce_transform, GFP_KERNEL); if (!transform) return NULL; @@ -730,7 +730,7 @@ static struct link_encoder *dce60_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = - kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc110) @@ -765,7 +765,7 @@ static struct link_encoder *dce60_link_encoder_create( static struct panel_cntl *dce60_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -787,7 +787,7 @@ static struct clock_source *dce60_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -812,7 +812,7 @@ static void dce60_clock_source_destroy(struct clock_source **clk_src) static struct input_pixel_processor *dce60_ipp_create( struct dc_context *ctx, uint32_t inst) { - struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL); + struct dce_ipp *ipp = kzalloc_obj(struct dce_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -1098,7 +1098,7 @@ struct resource_pool *dce60_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; @@ -1296,7 +1296,7 @@ struct resource_pool *dce61_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; @@ -1493,7 +1493,7 @@ struct resource_pool *dce64_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c index a68e799d5885..bef4a30caf7e 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c @@ -513,7 +513,7 @@ static struct timing_generator *dce80_timing_generator_create( const struct dce110_timing_generator_offsets *offsets) { struct dce110_timing_generator *tg110 = - kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL); + kzalloc_obj(struct dce110_timing_generator, GFP_KERNEL); if (!tg110) return NULL; @@ -527,7 +527,7 @@ static struct output_pixel_processor *dce80_opp_create( uint32_t inst) { struct dce110_opp *opp = - kzalloc(sizeof(struct dce110_opp), GFP_KERNEL); + kzalloc_obj(struct dce110_opp, GFP_KERNEL); if (!opp) return NULL; @@ -542,7 +542,7 @@ static struct dce_aux *dce80_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -580,7 +580,7 @@ static struct dce_i2c_hw *dce80_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -595,7 +595,7 @@ static struct dce_i2c_sw *dce80_i2c_sw_create( struct dc_context *ctx) { struct dce_i2c_sw *dce_i2c_sw = - kzalloc(sizeof(struct dce_i2c_sw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_sw, GFP_KERNEL); if (!dce_i2c_sw) return NULL; @@ -609,7 +609,7 @@ static struct stream_encoder *dce80_stream_encoder_create( struct dc_context *ctx) { struct dce110_stream_encoder *enc110 = - kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_stream_encoder, GFP_KERNEL); if (!enc110) return NULL; @@ -644,7 +644,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dce80_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -689,8 +689,8 @@ static struct mem_input *dce80_mem_input_create( struct dc_context *ctx, uint32_t inst) { - struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input), - GFP_KERNEL); + struct dce_mem_input *dce_mi = kzalloc_obj(struct dce_mem_input, + GFP_KERNEL); if (!dce_mi) { BREAK_TO_DEBUGGER(); @@ -713,7 +713,7 @@ static struct transform *dce80_transform_create( uint32_t inst) { struct dce_transform *transform = - kzalloc(sizeof(struct dce_transform), GFP_KERNEL); + kzalloc_obj(struct dce_transform, GFP_KERNEL); if (!transform) return NULL; @@ -736,7 +736,7 @@ static struct link_encoder *dce80_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = - kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dce110_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc110) @@ -771,7 +771,7 @@ static struct link_encoder *dce80_link_encoder_create( static struct panel_cntl *dce80_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -793,7 +793,7 @@ static struct clock_source *dce80_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -818,7 +818,7 @@ static void dce80_clock_source_destroy(struct clock_source **clk_src) static struct input_pixel_processor *dce80_ipp_create( struct dc_context *ctx, uint32_t inst) { - struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL); + struct dce_ipp *ipp = kzalloc_obj(struct dce_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -1109,7 +1109,7 @@ struct resource_pool *dce80_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; @@ -1309,7 +1309,7 @@ struct resource_pool *dce81_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; @@ -1507,7 +1507,7 @@ struct resource_pool *dce83_create_resource_pool( struct dc *dc) { struct dce110_resource_pool *pool = - kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dce110_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c index 476780a5450f..6c066576a5a5 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn10/dcn10_resource.c @@ -574,7 +574,7 @@ static struct dpp *dcn10_dpp_create( uint32_t inst) { struct dcn10_dpp *dpp = - kzalloc(sizeof(struct dcn10_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn10_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -588,7 +588,7 @@ static struct input_pixel_processor *dcn10_ipp_create( struct dc_context *ctx, uint32_t inst) { struct dcn10_ipp *ipp = - kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL); + kzalloc_obj(struct dcn10_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -605,7 +605,7 @@ static struct output_pixel_processor *dcn10_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn10_opp *opp = - kzalloc(sizeof(struct dcn10_opp), GFP_KERNEL); + kzalloc_obj(struct dcn10_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -621,7 +621,7 @@ static struct dce_aux *dcn10_aux_engine_create(struct dc_context *ctx, uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -658,7 +658,7 @@ static struct dce_i2c_hw *dcn10_i2c_hw_create(struct dc_context *ctx, uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -670,8 +670,7 @@ static struct dce_i2c_hw *dcn10_i2c_hw_create(struct dc_context *ctx, } static struct mpc *dcn10_mpc_create(struct dc_context *ctx) { - struct dcn10_mpc *mpc10 = kzalloc(sizeof(struct dcn10_mpc), - GFP_KERNEL); + struct dcn10_mpc *mpc10 = kzalloc_obj(struct dcn10_mpc, GFP_KERNEL); if (!mpc10) return NULL; @@ -687,8 +686,8 @@ static struct mpc *dcn10_mpc_create(struct dc_context *ctx) static struct hubbub *dcn10_hubbub_create(struct dc_context *ctx) { - struct dcn10_hubbub *dcn10_hubbub = kzalloc(sizeof(struct dcn10_hubbub), - GFP_KERNEL); + struct dcn10_hubbub *dcn10_hubbub = kzalloc_obj(struct dcn10_hubbub, + GFP_KERNEL); if (!dcn10_hubbub) return NULL; @@ -706,7 +705,7 @@ static struct timing_generator *dcn10_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -739,7 +738,7 @@ static struct link_encoder *dcn10_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn10_link_encoder *enc10 = - kzalloc(sizeof(struct dcn10_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn10_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc10 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -763,7 +762,7 @@ static struct link_encoder *dcn10_link_encoder_create( static struct panel_cntl *dcn10_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -785,7 +784,7 @@ static struct clock_source *dcn10_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -821,7 +820,7 @@ static struct stream_encoder *dcn10_stream_encoder_create( struct dc_context *ctx) { struct dcn10_stream_encoder *enc1 = - kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); if (!enc1) return NULL; @@ -847,7 +846,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dcn10_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -891,7 +890,7 @@ static void dcn10_clock_source_destroy(struct clock_source **clk_src) static struct pp_smu_funcs *dcn10_pp_smu_create(struct dc_context *ctx) { - struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_KERNEL); + struct pp_smu_funcs *pp_smu = kzalloc_obj(*pp_smu, GFP_KERNEL); if (!pp_smu) return pp_smu; @@ -984,7 +983,7 @@ static struct hubp *dcn10_hubp_create( uint32_t inst) { struct dcn10_hubp *hubp1 = - kzalloc(sizeof(struct dcn10_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn10_hubp, GFP_KERNEL); if (!hubp1) return NULL; @@ -1681,7 +1680,7 @@ struct resource_pool *dcn10_create_resource_pool( struct dc *dc) { struct dcn10_resource_pool *pool = - kzalloc(sizeof(struct dcn10_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn10_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c index 6731544f0981..ba83a78f7fc1 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c @@ -736,7 +736,7 @@ struct dpp *dcn20_dpp_create( uint32_t inst) { struct dcn20_dpp *dpp = - kzalloc(sizeof(struct dcn20_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn20_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -754,7 +754,7 @@ struct input_pixel_processor *dcn20_ipp_create( struct dc_context *ctx, uint32_t inst) { struct dcn10_ipp *ipp = - kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL); + kzalloc_obj(struct dcn10_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -771,7 +771,7 @@ struct output_pixel_processor *dcn20_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -788,7 +788,7 @@ struct dce_aux *dcn20_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -826,7 +826,7 @@ struct dce_i2c_hw *dcn20_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -838,7 +838,7 @@ struct dce_i2c_hw *dcn20_i2c_hw_create( } struct mpc *dcn20_mpc_create(struct dc_context *ctx) { - struct dcn20_mpc *mpc20 = kzalloc(sizeof(struct dcn20_mpc), GFP_KERNEL); + struct dcn20_mpc *mpc20 = kzalloc_obj(struct dcn20_mpc, GFP_KERNEL); if (!mpc20) return NULL; @@ -855,7 +855,8 @@ struct mpc *dcn20_mpc_create(struct dc_context *ctx) struct hubbub *dcn20_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL); + struct dcn20_hubbub *hubbub = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub) return NULL; @@ -883,7 +884,7 @@ struct timing_generator *dcn20_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -917,7 +918,7 @@ struct link_encoder *dcn20_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -941,7 +942,7 @@ struct link_encoder *dcn20_link_encoder_create( static struct panel_cntl *dcn20_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -963,7 +964,7 @@ static struct clock_source *dcn20_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -999,7 +1000,7 @@ struct stream_encoder *dcn20_stream_encoder_create( struct dc_context *ctx) { struct dcn10_stream_encoder *enc1 = - kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); if (!enc1) return NULL; @@ -1031,7 +1032,7 @@ static const struct dce_hwseq_mask hwseq_mask = { struct dce_hwseq *dcn20_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1062,7 +1063,7 @@ struct display_stream_compressor *dcn20_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1199,7 +1200,7 @@ struct hubp *dcn20_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -2130,7 +2131,8 @@ enum dc_status dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context, bool voltage_supported; display_e2e_pipe_params_st *pipes; - pipes = kcalloc(dc->res_pool->pipe_count, sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + pipes = kzalloc_objs(display_e2e_pipe_params_st, + dc->res_pool->pipe_count, GFP_KERNEL); if (!pipes) return DC_FAIL_BANDWIDTH_VALIDATE; @@ -2240,8 +2242,8 @@ bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool) uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn20_dwbc *dwbc20 = kzalloc(sizeof(struct dcn20_dwbc), - GFP_KERNEL); + struct dcn20_dwbc *dwbc20 = kzalloc_obj(struct dcn20_dwbc, + GFP_KERNEL); if (!dwbc20) { dm_error("DC: failed to create dwbc20!\n"); @@ -2265,8 +2267,8 @@ bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool) ASSERT(pipe_count > 0); for (i = 0; i < pipe_count; i++) { - struct dcn20_mmhubbub *mcif_wb20 = kzalloc(sizeof(struct dcn20_mmhubbub), - GFP_KERNEL); + struct dcn20_mmhubbub *mcif_wb20 = kzalloc_obj(struct dcn20_mmhubbub, + GFP_KERNEL); if (!mcif_wb20) { dm_error("DC: failed to create mcif_wb20!\n"); @@ -2286,7 +2288,7 @@ bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool) static struct pp_smu_funcs *dcn20_pp_smu_create(struct dc_context *ctx) { - struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_KERNEL); + struct pp_smu_funcs *pp_smu = kzalloc_obj(*pp_smu, GFP_KERNEL); if (!pp_smu) return pp_smu; @@ -2766,7 +2768,7 @@ struct resource_pool *dcn20_create_resource_pool( struct dc *dc) { struct dcn20_resource_pool *pool = - kzalloc(sizeof(struct dcn20_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn20_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c index 90d38631f63a..71629186eb30 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c @@ -632,7 +632,7 @@ static struct dpp *dcn201_dpp_create( uint32_t inst) { struct dcn201_dpp *dpp = - kzalloc(sizeof(struct dcn201_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn201_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -649,7 +649,7 @@ static struct input_pixel_processor *dcn201_ipp_create( struct dc_context *ctx, uint32_t inst) { struct dcn10_ipp *ipp = - kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL); + kzalloc_obj(struct dcn10_ipp, GFP_KERNEL); if (!ipp) { return NULL; @@ -665,7 +665,7 @@ static struct output_pixel_processor *dcn201_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn201_opp *opp = - kzalloc(sizeof(struct dcn201_opp), GFP_KERNEL); + kzalloc_obj(struct dcn201_opp, GFP_KERNEL); if (!opp) { return NULL; @@ -680,7 +680,7 @@ static struct dce_aux *dcn201_aux_engine_create(struct dc_context *ctx, uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -713,7 +713,7 @@ static struct dce_i2c_hw *dcn201_i2c_hw_create(struct dc_context *ctx, uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -726,7 +726,7 @@ static struct dce_i2c_hw *dcn201_i2c_hw_create(struct dc_context *ctx, static struct mpc *dcn201_mpc_create(struct dc_context *ctx, uint32_t num_mpcc) { - struct dcn201_mpc *mpc201 = kzalloc(sizeof(struct dcn201_mpc), GFP_KERNEL); + struct dcn201_mpc *mpc201 = kzalloc_obj(struct dcn201_mpc, GFP_KERNEL); if (!mpc201) return NULL; @@ -742,7 +742,8 @@ static struct mpc *dcn201_mpc_create(struct dc_context *ctx, uint32_t num_mpcc) static struct hubbub *dcn201_hubbub_create(struct dc_context *ctx) { - struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL); + struct dcn20_hubbub *hubbub = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub) return NULL; @@ -760,7 +761,7 @@ static struct timing_generator *dcn201_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -794,7 +795,7 @@ static struct link_encoder *dcn201_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); struct dcn10_link_encoder *enc10; if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -822,7 +823,7 @@ static struct clock_source *dcn201_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -857,7 +858,7 @@ static struct stream_encoder *dcn201_stream_encoder_create( struct dc_context *ctx) { struct dcn10_stream_encoder *enc1 = - kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); if (!enc1) return NULL; @@ -884,7 +885,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dcn201_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -984,7 +985,7 @@ static struct hubp *dcn201_hubp_create( uint32_t inst) { struct dcn201_hubp *hubp201 = - kzalloc(sizeof(struct dcn201_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn201_hubp, GFP_KERNEL); if (!hubp201) return NULL; @@ -1305,7 +1306,7 @@ struct resource_pool *dcn201_create_resource_pool( struct dc *dc) { struct dcn201_resource_pool *pool = - kzalloc(sizeof(struct dcn201_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn201_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c index 107612595db6..0e93bc342011 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c @@ -484,7 +484,7 @@ static struct input_pixel_processor *dcn21_ipp_create( struct dc_context *ctx, uint32_t inst) { struct dcn10_ipp *ipp = - kzalloc(sizeof(struct dcn10_ipp), GFP_KERNEL); + kzalloc_obj(struct dcn10_ipp, GFP_KERNEL); if (!ipp) { BREAK_TO_DEBUGGER(); @@ -501,7 +501,7 @@ static struct dpp *dcn21_dpp_create( uint32_t inst) { struct dcn20_dpp *dpp = - kzalloc(sizeof(struct dcn20_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn20_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -520,7 +520,7 @@ static struct dce_aux *dcn21_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -557,7 +557,7 @@ static struct dce_i2c_hw *dcn21_i2c_hw_create(struct dc_context *ctx, uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -930,7 +930,8 @@ static enum dc_status dcn21_validate_bandwidth(struct dc *dc, struct dc_state *c bool voltage_supported; display_e2e_pipe_params_st *pipes; - pipes = kcalloc(dc->res_pool->pipe_count, sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + pipes = kzalloc_objs(display_e2e_pipe_params_st, + dc->res_pool->pipe_count, GFP_KERNEL); if (!pipes) return DC_FAIL_BANDWIDTH_VALIDATE; @@ -959,7 +960,7 @@ static struct clock_source *dcn21_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -980,7 +981,7 @@ static struct hubp *dcn21_hubp_create( uint32_t inst) { struct dcn21_hubp *hubp21 = - kzalloc(sizeof(struct dcn21_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn21_hubp, GFP_KERNEL); if (!hubp21) return NULL; @@ -998,8 +999,8 @@ static struct hubbub *dcn21_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub) return NULL; @@ -1027,7 +1028,7 @@ static struct output_pixel_processor *dcn21_opp_create(struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -1043,7 +1044,7 @@ static struct timing_generator *dcn21_timing_generator_create(struct dc_context uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1062,8 +1063,7 @@ static struct timing_generator *dcn21_timing_generator_create(struct dc_context static struct mpc *dcn21_mpc_create(struct dc_context *ctx) { - struct dcn20_mpc *mpc20 = kzalloc(sizeof(struct dcn20_mpc), - GFP_KERNEL); + struct dcn20_mpc *mpc20 = kzalloc_obj(struct dcn20_mpc, GFP_KERNEL); if (!mpc20) return NULL; @@ -1091,7 +1091,7 @@ static struct display_stream_compressor *dcn21_dsc_create(struct dc_context *ctx uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1104,7 +1104,7 @@ static struct display_stream_compressor *dcn21_dsc_create(struct dc_context *ctx static struct pp_smu_funcs *dcn21_pp_smu_create(struct dc_context *ctx) { - struct pp_smu_funcs *pp_smu = kzalloc(sizeof(*pp_smu), GFP_KERNEL); + struct pp_smu_funcs *pp_smu = kzalloc_obj(*pp_smu, GFP_KERNEL); if (!pp_smu) return pp_smu; @@ -1141,7 +1141,7 @@ static struct stream_encoder *dcn21_stream_encoder_create(enum engine_id eng_id, struct dc_context *ctx) { struct dcn10_stream_encoder *enc1 = - kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); if (!enc1) return NULL; @@ -1168,7 +1168,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dcn21_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1295,7 +1295,7 @@ static struct link_encoder *dcn21_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn21_link_encoder *enc21 = - kzalloc(sizeof(struct dcn21_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn21_link_encoder, GFP_KERNEL); int link_regs_id; if (!enc21 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) @@ -1319,7 +1319,7 @@ static struct link_encoder *dcn21_link_encoder_create( static struct panel_cntl *dcn21_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1704,7 +1704,7 @@ struct resource_pool *dcn21_create_resource_pool( struct dc *dc) { struct dcn21_resource_pool *pool = - kzalloc(sizeof(struct dcn21_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn21_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c index 6cfdc37dab58..75aa4b6d7133 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c @@ -753,7 +753,7 @@ static struct dpp *dcn30_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -771,7 +771,7 @@ static struct output_pixel_processor *dcn30_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -788,7 +788,7 @@ static struct dce_aux *dcn30_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -827,7 +827,7 @@ static struct dce_i2c_hw *dcn30_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -843,8 +843,7 @@ static struct mpc *dcn30_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -863,8 +862,8 @@ static struct hubbub *dcn30_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -893,7 +892,7 @@ static struct timing_generator *dcn30_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -927,7 +926,7 @@ static struct link_encoder *dcn30_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -947,7 +946,7 @@ static struct link_encoder *dcn30_link_encoder_create( static struct panel_cntl *dcn30_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dce_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dce_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -981,7 +980,7 @@ static struct vpg *dcn30_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_vpg *vpg3 = kzalloc(sizeof(struct dcn30_vpg), GFP_KERNEL); + struct dcn30_vpg *vpg3 = kzalloc_obj(struct dcn30_vpg, GFP_KERNEL); if (!vpg3) return NULL; @@ -998,7 +997,7 @@ static struct afmt *dcn30_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt3 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt3 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt3) return NULL; @@ -1027,7 +1026,7 @@ static struct stream_encoder *dcn30_stream_encoder_create(enum engine_id eng_id, } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn30_vpg_create(ctx, vpg_inst); afmt = dcn30_afmt_create(ctx, afmt_inst); @@ -1048,7 +1047,7 @@ static struct stream_encoder *dcn30_stream_encoder_create(enum engine_id eng_id, static struct dce_hwseq *dcn30_hwseq_create(struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1201,7 +1200,7 @@ static struct hubp *dcn30_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1221,8 +1220,8 @@ static bool dcn30_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1246,8 +1245,8 @@ static bool dcn30_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1269,7 +1268,7 @@ static struct display_stream_compressor *dcn30_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1303,7 +1302,7 @@ static struct clock_source *dcn30_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2048,8 +2047,9 @@ enum dc_status dcn30_validate_bandwidth(struct dc *dc, int vlevel = 0; int pipe_cnt = 0; - display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count, - sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + display_e2e_pipe_params_st *pipes = kzalloc_objs(display_e2e_pipe_params_st, + dc->res_pool->pipe_count, + GFP_KERNEL); DC_LOGGER_INIT(dc->ctx->logger); BW_VAL_TRACE_COUNT(); @@ -2622,7 +2622,7 @@ struct resource_pool *dcn30_create_resource_pool( struct dc *dc) { struct dcn30_resource_pool *pool = - kzalloc(sizeof(struct dcn30_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn30_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn301/dcn301_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn301/dcn301_resource.c index e1d0c166b484..6bced8def669 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn301/dcn301_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn301/dcn301_resource.c @@ -717,7 +717,7 @@ static void dcn301_dpp_destroy(struct dpp **dpp) static struct dpp *dcn301_dpp_create(struct dc_context *ctx, uint32_t inst) { struct dcn3_dpp *dpp = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -734,7 +734,7 @@ static struct output_pixel_processor *dcn301_opp_create(struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -749,7 +749,7 @@ static struct output_pixel_processor *dcn301_opp_create(struct dc_context *ctx, static struct dce_aux *dcn301_aux_engine_create(struct dc_context *ctx, uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -783,7 +783,7 @@ static const struct dce_i2c_mask i2c_masks = { static struct dce_i2c_hw *dcn301_i2c_hw_create(struct dc_context *ctx, uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -798,8 +798,7 @@ static struct mpc *dcn301_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -818,8 +817,8 @@ static struct hubbub *dcn301_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -849,7 +848,7 @@ static struct timing_generator *dcn301_timing_generator_create( struct dc_context *ctx, uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -883,7 +882,7 @@ static struct link_encoder *dcn301_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -903,7 +902,7 @@ static struct link_encoder *dcn301_link_encoder_create( static struct panel_cntl *dcn301_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn301_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn301_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn301_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -952,7 +951,7 @@ static struct vpg *dcn301_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_vpg *vpg3 = kzalloc(sizeof(struct dcn30_vpg), GFP_KERNEL); + struct dcn30_vpg *vpg3 = kzalloc_obj(struct dcn30_vpg, GFP_KERNEL); if (!vpg3) return NULL; @@ -969,7 +968,7 @@ static struct afmt *dcn301_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt3 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt3 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt3) return NULL; @@ -998,7 +997,7 @@ static struct stream_encoder *dcn301_stream_encoder_create(enum engine_id eng_id } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn301_vpg_create(ctx, vpg_inst); afmt = dcn301_afmt_create(ctx, afmt_inst); @@ -1019,7 +1018,7 @@ static struct stream_encoder *dcn301_stream_encoder_create(enum engine_id eng_id static struct dce_hwseq *dcn301_hwseq_create(struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1161,7 +1160,7 @@ static void dcn301_destruct(struct dcn301_resource_pool *pool) static struct hubp *dcn301_hubp_create(struct dc_context *ctx, uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1181,8 +1180,8 @@ static bool dcn301_dwbc_create(struct dc_context *ctx, struct resource_pool *poo uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1206,8 +1205,8 @@ static bool dcn301_mmhubbub_create(struct dc_context *ctx, struct resource_pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1229,7 +1228,7 @@ static struct display_stream_compressor *dcn301_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1258,7 +1257,7 @@ static struct clock_source *dcn301_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -1728,7 +1727,7 @@ struct resource_pool *dcn301_create_resource_pool( struct dc *dc) { struct dcn301_resource_pool *pool = - kzalloc(sizeof(struct dcn301_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn301_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c index c0d4a1dc94f8..1dba37343c0f 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c @@ -257,7 +257,8 @@ static struct hubbub *dcn302_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -299,7 +300,7 @@ static const struct dcn30_vpg_mask vpg_mask = { static struct vpg *dcn302_vpg_create(struct dc_context *ctx, uint32_t inst) { - struct dcn30_vpg *vpg3 = kzalloc(sizeof(struct dcn30_vpg), GFP_KERNEL); + struct dcn30_vpg *vpg3 = kzalloc_obj(struct dcn30_vpg, GFP_KERNEL); if (!vpg3) return NULL; @@ -331,7 +332,7 @@ static const struct dcn30_afmt_mask afmt_mask = { static struct afmt *dcn302_afmt_create(struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt3 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt3 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt3) return NULL; @@ -406,7 +407,7 @@ static struct stream_encoder *dcn302_stream_encoder_create(enum engine_id eng_id } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn302_vpg_create(ctx, vpg_inst); afmt = dcn302_afmt_create(ctx, afmt_inst); @@ -445,7 +446,8 @@ static const struct dce110_clk_src_mask cs_mask = { static struct clock_source *dcn302_clock_source_create(struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) { - struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + struct dce110_clk_src *clk_src = kzalloc_obj(struct dce110_clk_src, + GFP_KERNEL); if (!clk_src) return NULL; @@ -474,7 +476,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dcn302_hwseq_create(struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -506,7 +508,7 @@ static const struct dcn_hubp2_mask hubp_mask = { static struct hubp *dcn302_hubp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn20_hubp *hubp2 = kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + struct dcn20_hubp *hubp2 = kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -540,7 +542,7 @@ static const struct dcn3_dpp_mask tf_mask = { static struct dpp *dcn302_dpp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn3_dpp *dpp = kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + struct dcn3_dpp *dpp = kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -574,7 +576,7 @@ static const struct dcn20_opp_mask opp_mask = { static struct output_pixel_processor *dcn302_opp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn20_opp *opp = kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + struct dcn20_opp *opp = kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -606,7 +608,7 @@ static const struct dcn_optc_mask optc_mask = { static struct timing_generator *dcn302_timing_generator_create(struct dc_context *ctx, uint32_t instance) { - struct optc *tgn10 = kzalloc(sizeof(struct optc), GFP_KERNEL); + struct optc *tgn10 = kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -651,7 +653,7 @@ static const struct dcn30_mpc_mask mpc_mask = { static struct mpc *dcn302_mpc_create(struct dc_context *ctx, int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -682,7 +684,7 @@ static const struct dcn20_dsc_mask dsc_mask = { static struct display_stream_compressor *dcn302_dsc_create(struct dc_context *ctx, uint32_t inst) { - struct dcn20_dsc *dsc = kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + struct dcn20_dsc *dsc = kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -714,7 +716,8 @@ static bool dcn302_dwbc_create(struct dc_context *ctx, struct resource_pool *poo uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -749,7 +752,8 @@ static bool dcn302_mmhubbub_create(struct dc_context *ctx, struct resource_pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -789,7 +793,8 @@ static const struct dce110_aux_registers_mask aux_mask = { static struct dce_aux *dcn302_aux_engine_create(struct dc_context *ctx, uint32_t inst) { - struct aux_engine_dce110 *aux_engine = kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + struct aux_engine_dce110 *aux_engine = kzalloc_obj(struct aux_engine_dce110, + GFP_KERNEL); if (!aux_engine) return NULL; @@ -820,7 +825,8 @@ static const struct dce_i2c_mask i2c_masks = { static struct dce_i2c_hw *dcn302_i2c_hw_create(struct dc_context *ctx, uint32_t inst) { - struct dce_i2c_hw *dce_i2c_hw = kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + struct dce_i2c_hw *dce_i2c_hw = kzalloc_obj(struct dce_i2c_hw, + GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -894,7 +900,8 @@ static struct link_encoder *dcn302_link_encoder_create( struct dc_context *ctx, const struct encoder_init_data *enc_init_data) { - struct dcn20_link_encoder *enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + struct dcn20_link_encoder *enc20 = kzalloc_obj(struct dcn20_link_encoder, + GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -920,7 +927,8 @@ static const struct dce_panel_cntl_mask panel_cntl_mask = { static struct panel_cntl *dcn302_panel_cntl_create(const struct panel_cntl_init_data *init_data) { - struct dce_panel_cntl *panel_cntl = kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + struct dce_panel_cntl *panel_cntl = kzalloc_obj(struct dce_panel_cntl, + GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1512,7 +1520,8 @@ create_fail: struct resource_pool *dcn302_create_resource_pool(const struct dc_init_data *init_data, struct dc *dc) { - struct resource_pool *pool = kzalloc(sizeof(struct resource_pool), GFP_KERNEL); + struct resource_pool *pool = kzalloc_obj(struct resource_pool, + GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c index 75e09c2c283e..2f81c0b51d1a 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c @@ -253,7 +253,8 @@ static struct hubbub *dcn303_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -292,7 +293,7 @@ static const struct dcn30_vpg_mask vpg_mask = { static struct vpg *dcn303_vpg_create(struct dc_context *ctx, uint32_t inst) { - struct dcn30_vpg *vpg3 = kzalloc(sizeof(struct dcn30_vpg), GFP_KERNEL); + struct dcn30_vpg *vpg3 = kzalloc_obj(struct dcn30_vpg, GFP_KERNEL); if (!vpg3) return NULL; @@ -321,7 +322,7 @@ static const struct dcn30_afmt_mask afmt_mask = { static struct afmt *dcn303_afmt_create(struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt3 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt3 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt3) return NULL; @@ -393,7 +394,7 @@ static struct stream_encoder *dcn303_stream_encoder_create(enum engine_id eng_id } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn303_vpg_create(ctx, vpg_inst); afmt = dcn303_afmt_create(ctx, afmt_inst); @@ -429,7 +430,8 @@ static const struct dce110_clk_src_mask cs_mask = { static struct clock_source *dcn303_clock_source_create(struct dc_context *ctx, struct dc_bios *bios, enum clock_source_id id, const struct dce110_clk_src_regs *regs, bool dp_clk_src) { - struct dce110_clk_src *clk_src = kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + struct dce110_clk_src *clk_src = kzalloc_obj(struct dce110_clk_src, + GFP_KERNEL); if (!clk_src) return NULL; @@ -458,7 +460,7 @@ static const struct dce_hwseq_mask hwseq_mask = { static struct dce_hwseq *dcn303_hwseq_create(struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -487,7 +489,7 @@ static const struct dcn_hubp2_mask hubp_mask = { static struct hubp *dcn303_hubp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn20_hubp *hubp2 = kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + struct dcn20_hubp *hubp2 = kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -518,7 +520,7 @@ static const struct dcn3_dpp_mask tf_mask = { static struct dpp *dcn303_dpp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn3_dpp *dpp = kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + struct dcn3_dpp *dpp = kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -549,7 +551,7 @@ static const struct dcn20_opp_mask opp_mask = { static struct output_pixel_processor *dcn303_opp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn20_opp *opp = kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + struct dcn20_opp *opp = kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -578,7 +580,7 @@ static const struct dcn_optc_mask optc_mask = { static struct timing_generator *dcn303_timing_generator_create(struct dc_context *ctx, uint32_t instance) { - struct optc *tgn10 = kzalloc(sizeof(struct optc), GFP_KERNEL); + struct optc *tgn10 = kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -615,7 +617,7 @@ static const struct dcn30_mpc_mask mpc_mask = { static struct mpc *dcn303_mpc_create(struct dc_context *ctx, int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -643,7 +645,7 @@ static const struct dcn20_dsc_mask dsc_mask = { static struct display_stream_compressor *dcn303_dsc_create(struct dc_context *ctx, uint32_t inst) { - struct dcn20_dsc *dsc = kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + struct dcn20_dsc *dsc = kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -675,7 +677,8 @@ static bool dcn303_dwbc_create(struct dc_context *ctx, struct resource_pool *poo uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -710,7 +713,8 @@ static bool dcn303_mmhubbub_create(struct dc_context *ctx, struct resource_pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -747,7 +751,8 @@ static const struct dce110_aux_registers_mask aux_mask = { static struct dce_aux *dcn303_aux_engine_create(struct dc_context *ctx, uint32_t inst) { - struct aux_engine_dce110 *aux_engine = kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + struct aux_engine_dce110 *aux_engine = kzalloc_obj(struct aux_engine_dce110, + GFP_KERNEL); if (!aux_engine) return NULL; @@ -775,7 +780,8 @@ static const struct dce_i2c_mask i2c_masks = { static struct dce_i2c_hw *dcn303_i2c_hw_create(struct dc_context *ctx, uint32_t inst) { - struct dce_i2c_hw *dce_i2c_hw = kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + struct dce_i2c_hw *dce_i2c_hw = kzalloc_obj(struct dce_i2c_hw, + GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -839,7 +845,8 @@ static struct link_encoder *dcn303_link_encoder_create( struct dc_context *ctx, const struct encoder_init_data *enc_init_data) { - struct dcn20_link_encoder *enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + struct dcn20_link_encoder *enc20 = kzalloc_obj(struct dcn20_link_encoder, + GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -865,7 +872,8 @@ static const struct dce_panel_cntl_mask panel_cntl_mask = { static struct panel_cntl *dcn303_panel_cntl_create(const struct panel_cntl_init_data *init_data) { - struct dce_panel_cntl *panel_cntl = kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); + struct dce_panel_cntl *panel_cntl = kzalloc_obj(struct dce_panel_cntl, + GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1444,7 +1452,8 @@ create_fail: struct resource_pool *dcn303_create_resource_pool(const struct dc_init_data *init_data, struct dc *dc) { - struct resource_pool *pool = kzalloc(sizeof(struct resource_pool), GFP_KERNEL); + struct resource_pool *pool = kzalloc_obj(struct resource_pool, + GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c index 8ad72557b16a..4fb54637f41e 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c @@ -919,7 +919,7 @@ static struct dpp *dcn31_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -937,7 +937,7 @@ static struct output_pixel_processor *dcn31_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -954,7 +954,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -991,7 +991,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -1006,8 +1006,7 @@ static struct mpc *dcn31_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -1026,8 +1025,8 @@ static struct hubbub *dcn31_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1059,7 +1058,7 @@ static struct timing_generator *dcn31_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1093,7 +1092,7 @@ static struct link_encoder *dcn31_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1122,7 +1121,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1139,7 +1138,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1169,7 +1168,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1186,7 +1185,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1205,7 +1204,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1235,7 +1234,7 @@ static struct stream_encoder *dcn31_stream_encoder_create( } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1285,7 +1284,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1311,7 +1311,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1325,7 +1325,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn31_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1499,7 +1499,7 @@ static struct hubp *dcn31_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1519,8 +1519,8 @@ static bool dcn31_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1544,8 +1544,8 @@ static bool dcn31_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1567,7 +1567,7 @@ static struct display_stream_compressor *dcn31_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1595,7 +1595,7 @@ static struct clock_source *dcn31_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -1771,8 +1771,9 @@ enum dc_status dcn31_validate_bandwidth(struct dc *dc, int vlevel = 0; int pipe_cnt = 0; - display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count, - sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + display_e2e_pipe_params_st *pipes = kzalloc_objs(display_e2e_pipe_params_st, + dc->res_pool->pipe_count, + GFP_KERNEL); DC_LOGGER_INIT(dc->ctx->logger); BW_VAL_TRACE_COUNT(); @@ -1866,7 +1867,7 @@ static struct clock_source *dcn30_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2227,7 +2228,7 @@ struct resource_pool *dcn31_create_resource_pool( struct dc *dc) { struct dcn31_resource_pool *pool = - kzalloc(sizeof(struct dcn31_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn31_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c index 5f0fe6e5bd82..8c451d2a040a 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c @@ -955,7 +955,7 @@ static struct dpp *dcn31_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -973,7 +973,7 @@ static struct output_pixel_processor *dcn31_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -990,7 +990,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -1049,7 +1049,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -1064,8 +1064,7 @@ static struct mpc *dcn31_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -1084,8 +1083,8 @@ static struct hubbub *dcn31_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1117,7 +1116,7 @@ static struct timing_generator *dcn31_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1151,7 +1150,7 @@ static struct link_encoder *dcn31_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1180,7 +1179,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1197,7 +1196,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1227,7 +1226,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1244,7 +1243,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1263,7 +1262,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1293,7 +1292,7 @@ static struct stream_encoder *dcn314_stream_encoder_create( } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1344,7 +1343,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1370,7 +1370,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1384,7 +1384,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn314_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1557,7 +1557,7 @@ static struct hubp *dcn31_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1577,8 +1577,8 @@ static bool dcn31_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1602,8 +1602,8 @@ static bool dcn31_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1625,7 +1625,7 @@ static struct display_stream_compressor *dcn314_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1653,7 +1653,7 @@ static struct clock_source *dcn31_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -1709,8 +1709,9 @@ enum dc_status dcn314_validate_bandwidth(struct dc *dc, int vlevel = 0; int pipe_cnt = 0; - display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count, - sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + display_e2e_pipe_params_st *pipes = kzalloc_objs(display_e2e_pipe_params_st, + dc->res_pool->pipe_count, + GFP_KERNEL); DC_LOGGER_INIT(dc->ctx->logger); BW_VAL_TRACE_COUNT(); @@ -1797,7 +1798,7 @@ static struct clock_source *dcn30_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2145,7 +2146,7 @@ struct resource_pool *dcn314_create_resource_pool( struct dc *dc) { struct dcn314_resource_pool *pool = - kzalloc(sizeof(struct dcn314_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn314_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c index 3ae787a377b1..1a63eaf5e1d9 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c @@ -918,7 +918,7 @@ static struct dpp *dcn31_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -936,7 +936,7 @@ static struct output_pixel_processor *dcn31_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -953,7 +953,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -990,7 +990,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -1005,8 +1005,7 @@ static struct mpc *dcn31_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -1025,8 +1024,8 @@ static struct hubbub *dcn31_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1058,7 +1057,7 @@ static struct timing_generator *dcn31_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1092,7 +1091,7 @@ static struct link_encoder *dcn31_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1121,7 +1120,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1138,7 +1137,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1168,7 +1167,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1185,7 +1184,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1204,7 +1203,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1236,7 +1235,7 @@ static struct stream_encoder *dcn315_stream_encoder_create( vpg_inst = eng_id; afmt_inst = eng_id; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1286,7 +1285,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1312,7 +1312,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1326,7 +1326,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn31_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1500,7 +1500,7 @@ static struct hubp *dcn31_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1520,8 +1520,8 @@ static bool dcn31_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1545,8 +1545,8 @@ static bool dcn31_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1568,7 +1568,7 @@ static struct display_stream_compressor *dcn31_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1596,7 +1596,7 @@ static struct clock_source *dcn31_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2167,7 +2167,7 @@ struct resource_pool *dcn315_create_resource_pool( struct dc *dc) { struct dcn315_resource_pool *pool = - kzalloc(sizeof(struct dcn315_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn315_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c index 4b8668458f03..4b8dddba34b8 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c @@ -911,7 +911,7 @@ static struct dpp *dcn31_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp) return NULL; @@ -929,7 +929,7 @@ static struct output_pixel_processor *dcn31_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -946,7 +946,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -983,7 +983,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -998,8 +998,7 @@ static struct mpc *dcn31_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -1018,8 +1017,8 @@ static struct hubbub *dcn31_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1051,7 +1050,7 @@ static struct timing_generator *dcn31_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1085,7 +1084,7 @@ static struct link_encoder *dcn31_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1114,7 +1113,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1131,7 +1130,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1161,7 +1160,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1178,7 +1177,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1198,7 +1197,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1229,7 +1228,7 @@ static struct stream_encoder *dcn316_stream_encoder_create( vpg_inst = eng_id; afmt_inst = eng_id; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1280,7 +1279,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1306,7 +1306,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1321,7 +1321,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn31_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); if (hws) { hws->ctx = ctx; @@ -1492,7 +1492,7 @@ static struct hubp *dcn31_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1512,8 +1512,8 @@ static bool dcn31_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1537,8 +1537,8 @@ static bool dcn31_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1560,7 +1560,7 @@ static struct display_stream_compressor *dcn31_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1588,7 +1588,7 @@ static struct clock_source *dcn31_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2034,7 +2034,7 @@ struct resource_pool *dcn316_create_resource_pool( struct dc *dc) { struct dcn316_resource_pool *pool = - kzalloc(sizeof(struct dcn316_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn316_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c index a55078458ba5..a93862071ff5 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c @@ -750,7 +750,7 @@ static struct dce_aux *dcn32_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -790,7 +790,7 @@ static struct dce_i2c_hw *dcn32_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -817,7 +817,7 @@ static struct clock_source *dcn32_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -837,8 +837,8 @@ static struct hubbub *dcn32_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub2) return NULL; @@ -893,7 +893,7 @@ static struct hubp *dcn32_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -925,7 +925,7 @@ static struct dpp *dcn32_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp3 = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp3) return NULL; @@ -951,8 +951,7 @@ static struct mpc *dcn32_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -975,7 +974,7 @@ static struct output_pixel_processor *dcn32_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp2 = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp2) { BREAK_TO_DEBUGGER(); @@ -1000,7 +999,7 @@ static struct timing_generator *dcn32_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1041,7 +1040,7 @@ static struct link_encoder *dcn32_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1085,7 +1084,7 @@ static struct link_encoder *dcn32_link_encoder_create( struct panel_cntl *dcn32_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1124,7 +1123,7 @@ static struct vpg *dcn32_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_vpg *vpg3 = kzalloc(sizeof(struct dcn30_vpg), GFP_KERNEL); + struct dcn30_vpg *vpg3 = kzalloc_obj(struct dcn30_vpg, GFP_KERNEL); if (!vpg3) return NULL; @@ -1154,7 +1153,7 @@ static struct afmt *dcn32_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt3 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt3 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt3) return NULL; @@ -1180,7 +1179,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1217,7 +1216,7 @@ static struct stream_encoder *dcn32_stream_encoder_create( vpg_inst = eng_id; afmt_inst = eng_id; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn32_vpg_create(ctx, vpg_inst); afmt = dcn32_afmt_create(ctx, afmt_inst); @@ -1275,7 +1274,8 @@ static struct hpo_dp_stream_encoder *dcn32_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn32_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1308,7 +1308,7 @@ static struct hpo_dp_link_encoder *dcn32_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1327,7 +1327,7 @@ static struct hpo_dp_link_encoder *dcn32_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn32_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); #undef REG_STRUCT #define REG_STRUCT hwseq_reg @@ -1510,8 +1510,8 @@ static bool dcn32_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 dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1539,8 +1539,8 @@ static bool dcn32_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t dwb_count = pool->res_cap->num_dwb; for (i = 0; i < dwb_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1566,7 +1566,7 @@ static struct display_stream_compressor *dcn32_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1754,8 +1754,9 @@ static bool dml1_validate(struct dc *dc, struct dc_state *context, enum dc_valid int vlevel = 0; int pipe_cnt = 0; - display_e2e_pipe_params_st *pipes = kcalloc(dc->res_pool->pipe_count, - sizeof(display_e2e_pipe_params_st), GFP_KERNEL); + display_e2e_pipe_params_st *pipes = kzalloc_objs(display_e2e_pipe_params_st, + dc->res_pool->pipe_count, + GFP_KERNEL); /* To handle Freesync properly, setting FreeSync DML parameters * to its default state for the first stage of validation @@ -2571,7 +2572,7 @@ struct resource_pool *dcn32_create_resource_pool( struct dc *dc) { struct dcn32_resource_pool *pool = - kzalloc(sizeof(struct dcn32_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn32_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c index 188c3f24f110..97976318f4c0 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c @@ -744,7 +744,7 @@ static struct dce_aux *dcn321_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -784,7 +784,7 @@ static struct dce_i2c_hw *dcn321_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -811,7 +811,7 @@ static struct clock_source *dcn321_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -831,8 +831,8 @@ static struct hubbub *dcn321_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub2) return NULL; @@ -887,7 +887,7 @@ static struct hubp *dcn321_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -919,7 +919,7 @@ static struct dpp *dcn321_dpp_create( uint32_t inst) { struct dcn3_dpp *dpp3 = - kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); if (!dpp3) return NULL; @@ -945,8 +945,7 @@ static struct mpc *dcn321_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), - GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -969,7 +968,7 @@ static struct output_pixel_processor *dcn321_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp2 = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp2) { BREAK_TO_DEBUGGER(); @@ -994,7 +993,7 @@ static struct timing_generator *dcn321_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1035,7 +1034,7 @@ static struct link_encoder *dcn321_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1105,7 +1104,7 @@ static struct vpg *dcn321_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_vpg *vpg3 = kzalloc(sizeof(struct dcn30_vpg), GFP_KERNEL); + struct dcn30_vpg *vpg3 = kzalloc_obj(struct dcn30_vpg, GFP_KERNEL); if (!vpg3) return NULL; @@ -1135,7 +1134,7 @@ static struct afmt *dcn321_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt3 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt3 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt3) return NULL; @@ -1161,7 +1160,7 @@ static struct apg *dcn321_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1198,7 +1197,7 @@ static struct stream_encoder *dcn321_stream_encoder_create( vpg_inst = eng_id; afmt_inst = eng_id; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn321_vpg_create(ctx, vpg_inst); afmt = dcn321_afmt_create(ctx, afmt_inst); @@ -1256,7 +1255,8 @@ static struct hpo_dp_stream_encoder *dcn321_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn321_vpg_create(ctx, vpg_inst); apg = dcn321_apg_create(ctx, apg_inst); @@ -1289,7 +1289,7 @@ static struct hpo_dp_link_encoder *dcn321_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1308,7 +1308,7 @@ static struct hpo_dp_link_encoder *dcn321_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn321_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); #undef REG_STRUCT #define REG_STRUCT hwseq_reg @@ -1490,8 +1490,8 @@ static bool dcn321_dwbc_create(struct dc_context *ctx, struct resource_pool *poo uint32_t dwb_count = pool->res_cap->num_dwb; for (i = 0; i < dwb_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1519,8 +1519,8 @@ static bool dcn321_mmhubbub_create(struct dc_context *ctx, struct resource_pool uint32_t dwb_count = pool->res_cap->num_dwb; for (i = 0; i < dwb_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1546,7 +1546,7 @@ static struct display_stream_compressor *dcn321_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -2064,7 +2064,7 @@ struct resource_pool *dcn321_create_resource_pool( struct dc *dc) { struct dcn321_resource_pool *pool = - kzalloc(sizeof(struct dcn321_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn321_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c index 5ea805fcff48..26493ed5a6fc 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c @@ -810,7 +810,7 @@ static void dcn35_dpp_destroy(struct dpp **dpp) static struct dpp *dcn35_dpp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn3_dpp *dpp = kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + struct dcn3_dpp *dpp = kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); bool success = (dpp != NULL); if (!success) @@ -841,7 +841,7 @@ static struct output_pixel_processor *dcn35_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -868,7 +868,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -931,7 +931,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -954,7 +954,7 @@ static struct mpc *dcn35_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -977,8 +977,8 @@ static struct hubbub *dcn35_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1033,7 +1033,7 @@ static struct timing_generator *dcn35_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1074,7 +1074,7 @@ static struct link_encoder *dcn35_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1127,7 +1127,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1144,7 +1144,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1185,7 +1185,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1215,7 +1215,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1243,7 +1243,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1280,7 +1280,7 @@ static struct stream_encoder *dcn35_stream_encoder_create( vpg_inst = eng_id; afmt_inst = eng_id; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1338,7 +1338,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1371,7 +1372,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1390,7 +1391,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn35_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); #undef REG_STRUCT #define REG_STRUCT hwseq_reg @@ -1571,7 +1572,7 @@ static struct hubp *dcn35_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1604,8 +1605,8 @@ static bool dcn35_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1643,8 +1644,8 @@ static bool dcn35_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1672,7 +1673,7 @@ static struct display_stream_compressor *dcn35_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1709,7 +1710,7 @@ static struct clock_source *dcn35_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2209,7 +2210,7 @@ struct resource_pool *dcn35_create_resource_pool( struct dc *dc) { struct dcn35_resource_pool *pool = - kzalloc(sizeof(struct dcn35_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn35_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c index 424b52e2dd7b..0e204d8e1336 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c @@ -790,7 +790,7 @@ static void dcn35_dpp_destroy(struct dpp **dpp) static struct dpp *dcn35_dpp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn3_dpp *dpp = kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + struct dcn3_dpp *dpp = kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); bool success = (dpp != NULL); if (!success) @@ -821,7 +821,7 @@ static struct output_pixel_processor *dcn35_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -848,7 +848,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -911,7 +911,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -934,7 +934,7 @@ static struct mpc *dcn35_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -957,8 +957,8 @@ static struct hubbub *dcn35_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1013,7 +1013,7 @@ static struct timing_generator *dcn35_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1054,7 +1054,7 @@ static struct link_encoder *dcn35_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1107,7 +1107,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1124,7 +1124,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1165,7 +1165,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1195,7 +1195,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1223,7 +1223,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1260,7 +1260,7 @@ static struct stream_encoder *dcn35_stream_encoder_create( vpg_inst = eng_id; afmt_inst = eng_id; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1318,7 +1318,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1351,7 +1352,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1370,7 +1371,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn351_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); #undef REG_STRUCT #define REG_STRUCT hwseq_reg @@ -1551,7 +1552,7 @@ static struct hubp *dcn35_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1584,8 +1585,8 @@ static bool dcn35_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1623,8 +1624,8 @@ static bool dcn35_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1652,7 +1653,7 @@ static struct display_stream_compressor *dcn35_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1689,7 +1690,7 @@ static struct clock_source *dcn35_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2182,7 +2183,7 @@ struct resource_pool *dcn351_create_resource_pool( struct dc *dc) { struct dcn351_resource_pool *pool = - kzalloc(sizeof(struct dcn351_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn351_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c index 7582217bd06d..c0cf8c46031f 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c @@ -797,7 +797,7 @@ static void dcn35_dpp_destroy(struct dpp **dpp) static struct dpp *dcn35_dpp_create(struct dc_context *ctx, uint32_t inst) { - struct dcn3_dpp *dpp = kzalloc(sizeof(struct dcn3_dpp), GFP_KERNEL); + struct dcn3_dpp *dpp = kzalloc_obj(struct dcn3_dpp, GFP_KERNEL); bool success = (dpp != NULL); if (!success) @@ -828,7 +828,7 @@ static struct output_pixel_processor *dcn35_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp) { BREAK_TO_DEBUGGER(); @@ -855,7 +855,7 @@ static struct dce_aux *dcn31_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -918,7 +918,7 @@ static struct dce_i2c_hw *dcn31_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -941,7 +941,7 @@ static struct mpc *dcn35_mpc_create( int num_mpcc, int num_rmu) { - struct dcn30_mpc *mpc30 = kzalloc(sizeof(struct dcn30_mpc), GFP_KERNEL); + struct dcn30_mpc *mpc30 = kzalloc_obj(struct dcn30_mpc, GFP_KERNEL); if (!mpc30) return NULL; @@ -964,8 +964,8 @@ static struct hubbub *dcn35_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub3) return NULL; @@ -1020,7 +1020,7 @@ static struct timing_generator *dcn35_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1061,7 +1061,7 @@ static struct link_encoder *dcn35_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1114,7 +1114,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( if ((eng_id - ENGINE_ID_DIGA) > ctx->dc->res_pool->res_cap->num_dig_link_enc) return NULL; - enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + enc20 = kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20) return NULL; @@ -1131,7 +1131,7 @@ static struct link_encoder *dcn31_link_enc_create_minimal( static struct panel_cntl *dcn31_panel_cntl_create(const struct panel_cntl_init_data *init_data) { struct dcn31_panel_cntl *panel_cntl = - kzalloc(sizeof(struct dcn31_panel_cntl), GFP_KERNEL); + kzalloc_obj(struct dcn31_panel_cntl, GFP_KERNEL); if (!panel_cntl) return NULL; @@ -1172,7 +1172,7 @@ static struct vpg *dcn31_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg31 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg31 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg31) return NULL; @@ -1202,7 +1202,7 @@ static struct afmt *dcn31_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_afmt *afmt31 = kzalloc(sizeof(struct dcn31_afmt), GFP_KERNEL); + struct dcn31_afmt *afmt31 = kzalloc_obj(struct dcn31_afmt, GFP_KERNEL); if (!afmt31) return NULL; @@ -1230,7 +1230,7 @@ static struct apg *dcn31_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1267,7 +1267,7 @@ static struct stream_encoder *dcn35_stream_encoder_create( } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); afmt = dcn31_afmt_create(ctx, afmt_inst); @@ -1325,7 +1325,8 @@ static struct hpo_dp_stream_encoder *dcn31_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn31_vpg_create(ctx, vpg_inst); apg = dcn31_apg_create(ctx, apg_inst); @@ -1358,7 +1359,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1377,7 +1378,7 @@ static struct hpo_dp_link_encoder *dcn31_hpo_dp_link_encoder_create( static struct dce_hwseq *dcn36_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); #undef REG_STRUCT #define REG_STRUCT hwseq_reg @@ -1558,7 +1559,7 @@ static struct hubp *dcn35_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -1591,8 +1592,8 @@ static bool dcn35_dwbc_create(struct dc_context *ctx, struct resource_pool *pool uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_dwbc *dwbc30 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc30 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc30) { dm_error("DC: failed to create dwbc30!\n"); @@ -1630,8 +1631,8 @@ static bool dcn35_mmhubbub_create(struct dc_context *ctx, struct resource_pool * uint32_t pipe_count = pool->res_cap->num_dwb; for (i = 0; i < pipe_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1659,7 +1660,7 @@ static struct display_stream_compressor *dcn35_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_dsc *dsc = - kzalloc(sizeof(struct dcn20_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn20_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -1696,7 +1697,7 @@ static struct clock_source *dcn35_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -2188,7 +2189,7 @@ struct resource_pool *dcn36_create_resource_pool( struct dc *dc) { struct dcn36_resource_pool *pool = - kzalloc(sizeof(struct dcn36_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn36_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c index f5e02a1ff771..db8a0c0b8cda 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c @@ -762,7 +762,7 @@ static struct dce_aux *dcn401_aux_engine_create( uint32_t inst) { struct aux_engine_dce110 *aux_engine = - kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); + kzalloc_obj(struct aux_engine_dce110, GFP_KERNEL); if (!aux_engine) return NULL; @@ -801,7 +801,7 @@ static struct dce_i2c_hw *dcn401_i2c_hw_create( uint32_t inst) { struct dce_i2c_hw *dce_i2c_hw = - kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); + kzalloc_obj(struct dce_i2c_hw, GFP_KERNEL); if (!dce_i2c_hw) return NULL; @@ -827,7 +827,7 @@ static struct clock_source *dcn401_clock_source_create( bool dp_clk_src) { struct dce110_clk_src *clk_src = - kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); + kzalloc_obj(struct dce110_clk_src, GFP_KERNEL); if (!clk_src) return NULL; @@ -847,8 +847,8 @@ static struct hubbub *dcn401_hubbub_create(struct dc_context *ctx) { int i; - struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub), - GFP_KERNEL); + struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub, + GFP_KERNEL); if (!hubbub2) return NULL; @@ -900,7 +900,7 @@ static struct hubbub *dcn401_hubbub_create(struct dc_context *ctx) static struct dio *dcn401_dio_create(struct dc_context *ctx) { - struct dcn10_dio *dio10 = kzalloc(sizeof(struct dcn10_dio), GFP_KERNEL); + struct dcn10_dio *dio10 = kzalloc_obj(struct dcn10_dio, GFP_KERNEL); if (!dio10) return NULL; @@ -919,7 +919,7 @@ static struct hubp *dcn401_hubp_create( uint32_t inst) { struct dcn20_hubp *hubp2 = - kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); + kzalloc_obj(struct dcn20_hubp, GFP_KERNEL); if (!hubp2) return NULL; @@ -951,7 +951,7 @@ static struct dpp *dcn401_dpp_create( uint32_t inst) { struct dcn401_dpp *dpp401 = - kzalloc(sizeof(struct dcn401_dpp), GFP_KERNEL); + kzalloc_obj(struct dcn401_dpp, GFP_KERNEL); if (!dpp401) return NULL; @@ -977,8 +977,7 @@ static struct mpc *dcn401_mpc_create( int num_mpcc, int num_rmu) { - struct dcn401_mpc *mpc401 = kzalloc(sizeof(struct dcn401_mpc), - GFP_KERNEL); + struct dcn401_mpc *mpc401 = kzalloc_obj(struct dcn401_mpc, GFP_KERNEL); if (!mpc401) return NULL; @@ -1001,7 +1000,7 @@ static struct output_pixel_processor *dcn401_opp_create( struct dc_context *ctx, uint32_t inst) { struct dcn20_opp *opp4 = - kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); + kzalloc_obj(struct dcn20_opp, GFP_KERNEL); if (!opp4) { BREAK_TO_DEBUGGER(); @@ -1026,7 +1025,7 @@ static struct timing_generator *dcn401_timing_generator_create( uint32_t instance) { struct optc *tgn10 = - kzalloc(sizeof(struct optc), GFP_KERNEL); + kzalloc_obj(struct optc, GFP_KERNEL); if (!tgn10) return NULL; @@ -1066,7 +1065,7 @@ static struct link_encoder *dcn401_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dcn20_link_encoder *enc20 = - kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); + kzalloc_obj(struct dcn20_link_encoder, GFP_KERNEL); if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) return NULL; @@ -1131,7 +1130,7 @@ static struct vpg *dcn401_vpg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); + struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg, GFP_KERNEL); if (!vpg4) return NULL; @@ -1161,7 +1160,7 @@ static struct afmt *dcn401_afmt_create( struct dc_context *ctx, uint32_t inst) { - struct dcn30_afmt *afmt401 = kzalloc(sizeof(struct dcn30_afmt), GFP_KERNEL); + struct dcn30_afmt *afmt401 = kzalloc_obj(struct dcn30_afmt, GFP_KERNEL); if (!afmt401) return NULL; @@ -1186,7 +1185,7 @@ static struct apg *dcn401_apg_create( struct dc_context *ctx, uint32_t inst) { - struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); + struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg, GFP_KERNEL); if (!apg31) return NULL; @@ -1223,7 +1222,7 @@ static struct stream_encoder *dcn401_stream_encoder_create( } else return NULL; - enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); + enc1 = kzalloc_obj(struct dcn10_stream_encoder, GFP_KERNEL); vpg = dcn401_vpg_create(ctx, vpg_inst); afmt = dcn401_afmt_create(ctx, afmt_inst); @@ -1279,7 +1278,8 @@ static struct hpo_dp_stream_encoder *dcn401_hpo_dp_stream_encoder_create( apg_inst = hpo_dp_inst; /* allocate HPO stream encoder and create VPG sub-block */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder, + GFP_KERNEL); vpg = dcn401_vpg_create(ctx, vpg_inst); apg = dcn401_apg_create(ctx, apg_inst); @@ -1312,7 +1312,7 @@ static struct hpo_dp_link_encoder *dcn401_hpo_dp_link_encoder_create( struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; /* allocate HPO link encoder */ - hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder, GFP_KERNEL); if (!hpo_dp_enc31) return NULL; /* out of memory */ @@ -1356,7 +1356,7 @@ static unsigned int dcn401_calc_num_avail_chans_for_mall(struct dc *dc, unsigned static struct dce_hwseq *dcn401_hwseq_create( struct dc_context *ctx) { - struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); + struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq, GFP_KERNEL); #undef REG_STRUCT #define REG_STRUCT hwseq_reg @@ -1551,8 +1551,8 @@ static bool dcn401_dwbc_create(struct dc_context *ctx, struct resource_pool *poo uint32_t dwb_count = pool->res_cap->num_dwb; for (i = 0; i < dwb_count; i++) { - struct dcn30_dwbc *dwbc401 = kzalloc(sizeof(struct dcn30_dwbc), - GFP_KERNEL); + struct dcn30_dwbc *dwbc401 = kzalloc_obj(struct dcn30_dwbc, + GFP_KERNEL); if (!dwbc401) { dm_error("DC: failed to create dwbc401!\n"); @@ -1582,8 +1582,8 @@ static bool dcn401_mmhubbub_create(struct dc_context *ctx, struct resource_pool uint32_t dwb_count = pool->res_cap->num_dwb; for (i = 0; i < dwb_count; i++) { - struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), - GFP_KERNEL); + struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub, + GFP_KERNEL); if (!mcif_wb30) { dm_error("DC: failed to create mcif_wb30!\n"); @@ -1609,7 +1609,7 @@ static struct display_stream_compressor *dcn401_dsc_create( struct dc_context *ctx, uint32_t inst) { struct dcn401_dsc *dsc = - kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL); + kzalloc_obj(struct dcn401_dsc, GFP_KERNEL); if (!dsc) { BREAK_TO_DEBUGGER(); @@ -2314,7 +2314,7 @@ struct resource_pool *dcn401_create_resource_pool( struct dc *dc) { struct dcn401_resource_pool *pool = - kzalloc(sizeof(struct dcn401_resource_pool), GFP_KERNEL); + kzalloc_obj(struct dcn401_resource_pool, GFP_KERNEL); if (!pool) return NULL; diff --git a/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/soc_and_ip_translator.c b/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/soc_and_ip_translator.c index 0fc0e5a6c171..1334d0efe6e3 100644 --- a/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/soc_and_ip_translator.c +++ b/drivers/gpu/drm/amd/display/dc/soc_and_ip_translator/soc_and_ip_translator.c @@ -21,7 +21,7 @@ struct soc_and_ip_translator *dc_create_soc_and_ip_translator(enum dce_version d { struct soc_and_ip_translator *soc_and_ip_translator; - soc_and_ip_translator = kzalloc(sizeof(*soc_and_ip_translator), GFP_KERNEL); + soc_and_ip_translator = kzalloc_obj(*soc_and_ip_translator, GFP_KERNEL); if (!soc_and_ip_translator) return NULL; diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c index a71df052cf25..33a7627191f8 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -933,7 +933,7 @@ static bool build_regamma(struct pwl_float_data_ex *rgb_regamma, struct pwl_float_data_ex *rgb = rgb_regamma; const struct hw_x_point *coord_x = coordinate_x; - coeff = kvzalloc(sizeof(*coeff), GFP_KERNEL); + coeff = kvzalloc_obj(*coeff, GFP_KERNEL); if (!coeff) goto release; @@ -1714,14 +1714,15 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps, input_tf->type = TF_TYPE_DISTRIBUTED_POINTS; if (map_user_ramp && ramp && ramp->type == GAMMA_RGB_256) { - rgb_user = kvcalloc(ramp->num_entries + _EXTRA_POINTS, - sizeof(*rgb_user), - GFP_KERNEL); + rgb_user = kvzalloc_objs(*rgb_user, + ramp->num_entries + _EXTRA_POINTS, + GFP_KERNEL); if (!rgb_user) goto rgb_user_alloc_fail; - axis_x = kvcalloc(ramp->num_entries + _EXTRA_POINTS, sizeof(*axis_x), - GFP_KERNEL); + axis_x = kvzalloc_objs(*axis_x, + ramp->num_entries + _EXTRA_POINTS, + GFP_KERNEL); if (!axis_x) goto axis_x_alloc_fail; @@ -1737,13 +1738,11 @@ bool mod_color_calculate_degamma_params(struct dc_color_caps *dc_caps, scale_gamma(rgb_user, ramp, dividers); } - curve = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, sizeof(*curve), - GFP_KERNEL); + curve = kvzalloc_objs(*curve, MAX_HW_POINTS + _EXTRA_POINTS, GFP_KERNEL); if (!curve) goto curve_alloc_fail; - coeff = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, sizeof(*coeff), - GFP_KERNEL); + coeff = kvzalloc_objs(*coeff, MAX_HW_POINTS + _EXTRA_POINTS, GFP_KERNEL); if (!coeff) goto coeff_alloc_fail; @@ -1940,14 +1939,14 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, if (ramp && ramp->type != GAMMA_CS_TFM_1D && (map_user_ramp || ramp->type != GAMMA_RGB_256)) { - rgb_user = kvcalloc(ramp->num_entries + _EXTRA_POINTS, - sizeof(*rgb_user), - GFP_KERNEL); + rgb_user = kvzalloc_objs(*rgb_user, + ramp->num_entries + _EXTRA_POINTS, + GFP_KERNEL); if (!rgb_user) goto rgb_user_alloc_fail; - axis_x = kvcalloc(ramp->num_entries + 3, sizeof(*axis_x), - GFP_KERNEL); + axis_x = kvzalloc_objs(*axis_x, ramp->num_entries + 3, + GFP_KERNEL); if (!axis_x) goto axis_x_alloc_fail; @@ -1966,14 +1965,12 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf, scale_gamma_dx(rgb_user, ramp, dividers); } - rgb_regamma = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, - sizeof(*rgb_regamma), - GFP_KERNEL); + rgb_regamma = kvzalloc_objs(*rgb_regamma, MAX_HW_POINTS + _EXTRA_POINTS, + GFP_KERNEL); if (!rgb_regamma) goto rgb_regamma_alloc_fail; - coeff = kvcalloc(MAX_HW_POINTS + _EXTRA_POINTS, sizeof(*coeff), - GFP_KERNEL); + coeff = kvzalloc_objs(*coeff, MAX_HW_POINTS + _EXTRA_POINTS, GFP_KERNEL); if (!coeff) goto coeff_alloc_fail; diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c index 1aae46d703ba..b819610021f2 100644 --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c @@ -61,7 +61,7 @@ struct core_freesync { struct mod_freesync *mod_freesync_create(struct dc *dc) { struct core_freesync *core_freesync = - kzalloc(sizeof(struct core_freesync), GFP_KERNEL); + kzalloc_obj(struct core_freesync, GFP_KERNEL); if (core_freesync == NULL) goto fail_alloc_context; diff --git a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c index 2c40212d86da..ccd35d1f05ec 100644 --- a/drivers/gpu/drm/amd/display/modules/vmid/vmid.c +++ b/drivers/gpu/drm/amd/display/modules/vmid/vmid.c @@ -144,7 +144,7 @@ struct mod_vmid *mod_vmid_create( if (dc == NULL) goto fail_dc_null; - core_vmid = kzalloc(sizeof(struct core_vmid), GFP_KERNEL); + core_vmid = kzalloc_obj(struct core_vmid, GFP_KERNEL); if (core_vmid == NULL) goto fail_alloc_context; |
