mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-23 08:35:09 -04:00
drm/amdgpu: Fix kcalloc over kzalloc in 'gmc_v9_0_init_mem_ranges'
Replace kzalloc(n * sizeof(...), ...) with kcalloc(n, sizeof(...), ...) since kcalloc is the preferred API in case of allocating with multiply. Fixes the below: WARNING: Prefer kcalloc over kzalloc with multiply Cc: Guchun Chen <guchun.chen@amd.com> Cc: Christian König <christian.koenig@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Guchun Chen <guchun.chen@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
e0e1764a3a
commit
f54e1d47e0
@@ -1972,10 +1972,9 @@ static int gmc_v9_0_init_mem_ranges(struct amdgpu_device *adev)
|
||||
{
|
||||
bool valid;
|
||||
|
||||
adev->gmc.mem_partitions = kzalloc(
|
||||
MAX_MEM_RANGES * sizeof(struct amdgpu_mem_partition_info),
|
||||
GFP_KERNEL);
|
||||
|
||||
adev->gmc.mem_partitions = kcalloc(MAX_MEM_RANGES,
|
||||
sizeof(struct amdgpu_mem_partition_info),
|
||||
GFP_KERNEL);
|
||||
if (!adev->gmc.mem_partitions)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user