From fe6689f01cb371f0f50a58a55ed48b69cb5baef2 Mon Sep 17 00:00:00 2001 From: Lalit Shankar Chowdhury Date: Sat, 19 Sep 2026 20:08:32 +0000 Subject: [PATCH] drm/amdgpu: replace kcalloc() with kzalloc_objs() Use kzalloc_objs() instead of kcalloc() to simplify object allocations. Convert only the instances with sizeof() passed. No functional change. Signed-off-by: Lalit Shankar Chowdhury Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c | 2 +- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 2 +- 19 files changed, 34 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 1b7673d239db..a81bc913a319 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -421,7 +421,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, siz return r; } - data = kcalloc(1024, sizeof(*data), GFP_KERNEL); + data = kzalloc_objs(*data, 1024); if (!data) { pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); amdgpu_virt_disable_access_debugfs(adev); @@ -1268,7 +1268,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, thread = (*pos & GENMASK_ULL(59, 52)) >> 52; bank = (*pos & GENMASK_ULL(61, 60)) >> 60; - data = kcalloc(1024, sizeof(*data), GFP_KERNEL); + data = kzalloc_objs(*data, 1024); if (!data) return -ENOMEM; @@ -2038,7 +2038,7 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) return -EBUSY; length = ring->fence_drv.num_fences_mask + 1; - fences = kcalloc(length, sizeof(void *), GFP_KERNEL); + fences = kzalloc_objs(*fences, length); if (!fences) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index 3017ddcefbe2..bff2d38f3571 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -460,8 +460,8 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring) ring->fence_drv.num_fences_mask = ring->num_hw_submission * 2 - 1; spin_lock_init(&ring->fence_drv.lock); - ring->fence_drv.fences = kcalloc(ring->num_hw_submission * 2, sizeof(void *), - GFP_KERNEL); + ring->fence_drv.fences = kzalloc_objs(*ring->fence_drv.fences, + ring->num_hw_submission * 2); if (!ring->fence_drv.fences) return -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c index 9887a4f99aed..87f879a2e4f4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c @@ -466,8 +466,8 @@ void amdgpu_jpeg_sysfs_reset_mask_fini(struct amdgpu_device *adev) int amdgpu_jpeg_reg_dump_init(struct amdgpu_device *adev, const struct amdgpu_hwip_reg_entry *reg, u32 count) { - adev->jpeg.ip_dump = kcalloc(adev->jpeg.num_jpeg_inst * count, - sizeof(uint32_t), GFP_KERNEL); + adev->jpeg.ip_dump = kzalloc_objs(*adev->jpeg.ip_dump, + adev->jpeg.num_jpeg_inst * count); if (!adev->jpeg.ip_dump) { dev_err(adev->dev, "Failed to allocate memory for JPEG IP Dump\n"); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c index 4cb37cdbf821..22ecb70fec2c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c @@ -257,8 +257,8 @@ int amdgpu_mes_init(struct amdgpu_device *adev) } adev->gfx.mec.mes_hung_db_array = - kcalloc(amdgpu_mes_get_hung_queue_db_array_size(adev), - sizeof(u32), GFP_KERNEL); + kzalloc_objs(*adev->gfx.mec.mes_hung_db_array, + amdgpu_mes_get_hung_queue_db_array_size(adev)); if (!adev->gfx.mec.mes_hung_db_array) { r = -ENOMEM; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 17db7264269e..34e1242d66ea 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -1571,8 +1571,8 @@ unlock: int amdgpu_vcn_reg_dump_init(struct amdgpu_device *adev, const struct amdgpu_hwip_reg_entry *reg, u32 count) { - adev->vcn.ip_dump = kcalloc(adev->vcn.num_vcn_inst * count, - sizeof(uint32_t), GFP_KERNEL); + adev->vcn.ip_dump = kzalloc_objs(*adev->vcn.ip_dump, + adev->vcn.num_vcn_inst * count); if (!adev->vcn.ip_dump) return -ENOMEM; adev->vcn.reg_list = reg; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 045b9c7d2a83..33403e16df5c 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -4720,7 +4720,7 @@ static void gfx_v10_0_alloc_ip_dump(struct amdgpu_device *adev) uint32_t *ptr; uint32_t inst; - ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX IP Dump\n"); adev->gfx.ip_dump_core = NULL; @@ -4733,7 +4733,7 @@ static void gfx_v10_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n"); adev->gfx.ip_dump_compute_queues = NULL; @@ -4746,7 +4746,7 @@ static void gfx_v10_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.me.num_me * adev->gfx.me.num_pipe_per_me * adev->gfx.me.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX Queues IP Dump\n"); adev->gfx.ip_dump_gfx_queues = NULL; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 70a7b890e70d..7bfc8cbdcad8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -1610,7 +1610,7 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev) uint32_t *ptr; uint32_t inst; - ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX IP Dump\n"); adev->gfx.ip_dump_core = NULL; @@ -1623,7 +1623,7 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n"); adev->gfx.ip_dump_compute_queues = NULL; @@ -1636,7 +1636,7 @@ static void gfx_v11_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.me.num_me * adev->gfx.me.num_pipe_per_me * adev->gfx.me.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX Queues IP Dump\n"); adev->gfx.ip_dump_gfx_queues = NULL; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c index 1b9a4e7ea833..b75512e7b1db 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c @@ -1376,7 +1376,7 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev) uint32_t *ptr; uint32_t inst; - ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX IP Dump\n"); adev->gfx.ip_dump_core = NULL; @@ -1389,7 +1389,7 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n"); adev->gfx.ip_dump_compute_queues = NULL; @@ -1402,7 +1402,7 @@ static void gfx_v12_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.me.num_me * adev->gfx.me.num_pipe_per_me * adev->gfx.me.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX Queues IP Dump\n"); adev->gfx.ip_dump_gfx_queues = NULL; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c index f5b6d6989289..91764f2e5ad0 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c @@ -1134,7 +1134,7 @@ static void gfx_v12_1_alloc_ip_dump(struct amdgpu_device *adev) num_xcc = NUM_XCC(adev->gfx.xcc_mask); - ptr = kcalloc(reg_count * num_xcc, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * num_xcc); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX IP Dump\n"); adev->gfx.ip_dump_core = NULL; @@ -1147,7 +1147,7 @@ static void gfx_v12_1_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst * num_xcc, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst * num_xcc); if (!ptr) { DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n"); adev->gfx.ip_dump_compute_queues = NULL; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 3ba2584e48c6..1678015ce5a9 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -2194,7 +2194,7 @@ static void gfx_v9_0_alloc_ip_dump(struct amdgpu_device *adev) uint32_t *ptr; uint32_t inst; - ptr = kcalloc(reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX IP Dump\n"); adev->gfx.ip_dump_core = NULL; @@ -2207,7 +2207,7 @@ static void gfx_v9_0_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst); if (!ptr) { DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n"); adev->gfx.ip_dump_compute_queues = NULL; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c index 484ecde55ac9..01ed1701c781 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c @@ -951,7 +951,7 @@ static void gfx_v9_4_3_alloc_ip_dump(struct amdgpu_device *adev) num_xcc = NUM_XCC(adev->gfx.xcc_mask); - ptr = kcalloc(reg_count * num_xcc, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * num_xcc); if (!ptr) { DRM_ERROR("Failed to allocate memory for GFX IP Dump\n"); adev->gfx.ip_dump_core = NULL; @@ -964,7 +964,7 @@ static void gfx_v9_4_3_alloc_ip_dump(struct amdgpu_device *adev) inst = adev->gfx.mec.num_mec * adev->gfx.mec.num_pipe_per_mec * adev->gfx.mec.num_queue_per_pipe; - ptr = kcalloc(reg_count * inst * num_xcc, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, reg_count * inst * num_xcc); if (!ptr) { DRM_ERROR("Failed to allocate memory for Compute Queues IP Dump\n"); adev->gfx.ip_dump_compute_queues = NULL; diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c index 902d31300326..ace34357c770 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -1894,7 +1894,7 @@ static int sdma_v4_0_sw_init(struct amdgpu_ip_block *ip_block) } /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c index df788361e865..b99fbad2ea01 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c @@ -1457,7 +1457,7 @@ static int sdma_v4_4_2_sw_init(struct amdgpu_ip_block *ip_block) } /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c index c6349f0e632f..201133fb5fcc 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c @@ -1408,7 +1408,7 @@ static int sdma_v5_0_sw_init(struct amdgpu_ip_block *ip_block) adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE; /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c index 683f27c27665..31edc02084dd 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c @@ -1328,7 +1328,7 @@ static int sdma_v5_2_sw_init(struct amdgpu_ip_block *ip_block) adev->sdma.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE; /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c index 16649dba6329..4845588c4c24 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c @@ -1339,7 +1339,7 @@ static int sdma_v6_0_sw_init(struct amdgpu_ip_block *ip_block) } /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c index edd9c437f7cb..50bc3a58da30 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c @@ -1348,7 +1348,7 @@ static int sdma_v7_0_sw_init(struct amdgpu_ip_block *ip_block) if (r) return r; /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c index 321c67e01443..fcbab7f05d08 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c @@ -1341,7 +1341,7 @@ static int sdma_v7_1_sw_init(struct amdgpu_ip_block *ip_block) if (r) return r; /* Allocate memory for SDMA IP Dump buffer */ - ptr = kcalloc(adev->sdma.num_instances * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->sdma.num_instances * reg_count); if (ptr) adev->sdma.ip_dump = ptr; else diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c index 72fd3022b606..76793a5caa70 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c @@ -202,7 +202,7 @@ static int vcn_v1_0_sw_init(struct amdgpu_ip_block *ip_block) r = jpeg_v1_0_sw_init(ip_block); /* Allocate memory for VCN IP Dump buffer */ - ptr = kcalloc(adev->vcn.num_vcn_inst * reg_count, sizeof(uint32_t), GFP_KERNEL); + ptr = kzalloc_objs(*ptr, adev->vcn.num_vcn_inst * reg_count); if (!ptr) { DRM_ERROR("Failed to allocate memory for VCN IP Dump\n"); adev->vcn.ip_dump = NULL;