drm/amdgpu: replace kcalloc() with kzalloc_objs()
Subsystems (2)
PATCH 1/1 drm/amdgpu: replace kcalloc() with kzalloc_objs()
Use kzalloc_objs() instead of kcalloc() to simplify object allocations.
No functional change.
--- 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/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 +- 18 files changed, 32 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -3
@@ -420,7 +420,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, sizreturn 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);
@@ -1267,7 +1267,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 ;
@@ -2035,7 +2035,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 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2 -2
@@ -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 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2 -2
@@ -465,8 +465,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" );
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -2
@@ -252,8 +252,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +3 -3
@@ -4716,7 +4716,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 ;
@@ -4729,7 +4729,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 ;
@@ -4742,7 +4742,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +3 -3
@@ -1568,7 +1568,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 ;
@@ -1581,7 +1581,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 ;
@@ -1594,7 +1594,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -3
@@ -1367,7 +1367,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 ;
@@ -1380,7 +1380,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 ;
@@ -1393,7 +1393,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +2 -2
@@ -1278,7 +1278,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 ;
@@ -1291,7 +1291,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
@@ -2190,7 +2190,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 ;
@@ -2203,7 +2203,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -2
@@ -946,7 +946,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 ;
@@ -959,7 +959,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 ;
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
@@ -1926,7 +1926,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
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -1
@@ -1531,7 +1531,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
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1434,7 +1434,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
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1 -1
@@ -1352,7 +1352,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
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +1 -1
@@ -1363,7 +1363,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
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +1 -1
@@ -1345,7 +1345,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
drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +1 -1
@@ -1333,7 +1333,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
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 -1
@@ -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 ;
Signature · 1 line
2.53.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] drm/amdgpu: incomplete refactoring, kcalloc still used for identical buffers --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] drm/amdgpu: incomplete refactoring, kcalloc still used for identical buffers --
commit 8b9c2e12d9fb1d601e7dde3709be635bf6ad1f1b
Author: Lalit Shankar Chowdhury <[email protected]>
Subject: drm/amdgpu: replace kcalloc() with kzalloc_objs()
This commit replaces kcalloc() with kzalloc_objs() across several files in the AMDGPU driver to simplify object allocations. The commit message states that it is a non-functional change.
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +0
-0
[ ... ]
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c static int vcn_v1_0_sw_init(struct amdgpu_ip_block *ip_block) · line 205
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1
-1@@ -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);
[Severity: Low]
Could we also update the identical IP dump buffer allocation in amdgpu_vcn_reg_dump_init() in drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c?
It looks like the refactoring might be incomplete. While this file and others (jpeg, sdma, gfx) were successfully updated to use kzalloc_objs(), several other instances using kcalloc() for identical buffer types were missed.
For example:
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:amdgpu_vcn_reg_dump_init() {
...
adev->vcn.ip_dump = kcalloc(adev->vcn.num_vcn_inst * count,
sizeof(uint32_t), GFP_KERNEL);
...
}Other files that still use kcalloc() include amdgpu_ras.c, amdgpu_ras_eeprom.c, and atom.c. Does it make sense to update these as well to ensure the memory allocation API remains consistent across the subsystem?
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +0
-0if (!ptr) {DRM_ERROR ("Failed to allocate memory for VCN IP Dump\n" ); adev->vcn.ip_dump =NULL ;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 1/1 drm/amdgpu: replace kcalloc() with kzalloc_objs()
In reply to Lalit Shankar ChowdhuryUse kzalloc_objs() instead of kcalloc() to simplify object allocations. Convert only the instances with sizeof() passed.
No functional change.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -3
@@ -420,7 +420,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, sizreturn 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);
@@ -1267,7 +1267,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 ;
@@ -2035,7 +2035,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 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2 -2
@@ -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 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2 -2
@@ -465,8 +465,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" );
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -2
@@ -252,8 +252,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 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
@@ -1571,8 +1571,8 @@ int amdgpu_vcn_ring_reset(struct amdgpu_ring *ring,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;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +3 -3
@@ -4716,7 +4716,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 ;
@@ -4729,7 +4729,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 ;
@@ -4742,7 +4742,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +3 -3
@@ -1568,7 +1568,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 ;
@@ -1581,7 +1581,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 ;
@@ -1594,7 +1594,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3 -3
@@ -1367,7 +1367,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 ;
@@ -1380,7 +1380,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 ;
@@ -1393,7 +1393,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +2 -2
@@ -1278,7 +1278,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 ;
@@ -1291,7 +1291,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
@@ -2190,7 +2190,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 ;
@@ -2203,7 +2203,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 ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -2
@@ -946,7 +946,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 ;
@@ -959,7 +959,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 ;
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1 -1
@@ -1926,7 +1926,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
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1 -1
@@ -1531,7 +1531,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
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1434,7 +1434,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
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1 -1
@@ -1352,7 +1352,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
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +1 -1
@@ -1363,7 +1363,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
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +1 -1
@@ -1345,7 +1345,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
drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +1 -1
@@ -1333,7 +1333,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
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1 -1
@@ -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 ;
Signature · 1 line
2.53.0
Alex Deucher
AppliedApplied. Thanks!
Quoted 386 lines · Lalit Shankar Chowdhury
Use
kzalloc_objs()instead ofkcalloc()to simplify object allocations. Convert only the instances withsizeof()passed.No functional change.
Signed-off-by Lalit Shankar Chowdhury <[email protected]>--- 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(-)drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3
-3@@ -420,7 +420,7 @@ static ssize_t amdgpu_debugfs_gprwave_read(struct file *f, char __user *buf, sizreturn 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);@@ -1267,7 +1267,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 ;@@ -2035,7 +2035,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 ;drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2
-2@@ -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 ;drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c +2
-2@@ -465,8 +465,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" );drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2
-2@@ -252,8 +252,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 ;drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2
-2@@ -1571,8 +1571,8 @@ int amdgpu_vcn_ring_reset(struct amdgpu_ring *ring,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;drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +3
-3@@ -4716,7 +4716,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 ;@@ -4729,7 +4729,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 ;@@ -4742,7 +4742,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 ;drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +3
-3@@ -1568,7 +1568,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 ;@@ -1581,7 +1581,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 ;@@ -1594,7 +1594,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 ;drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +3
-3@@ -1367,7 +1367,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 ;@@ -1380,7 +1380,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 ;@@ -1393,7 +1393,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 ;drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +2
-2@@ -1278,7 +1278,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 ;@@ -1291,7 +1291,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 ;drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-2@@ -2190,7 +2190,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 ;@@ -2203,7 +2203,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 ;drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2
-2@@ -946,7 +946,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 ;@@ -959,7 +959,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 ;drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +1
-1@@ -1926,7 +1926,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 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +1
-1@@ -1531,7 +1531,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 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1
-1@@ -1434,7 +1434,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 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +1
-1@@ -1352,7 +1352,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 drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +1
-1@@ -1363,7 +1363,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 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +1
-1@@ -1345,7 +1345,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 drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c +1
-1@@ -1333,7 +1333,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 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +1
-2@@ -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 ; --2.53.0