[PATCH] drm/amdgpu: Use kzalloc instead of kmalloc+__GFP_ZERO in amdgpu_ras.c
Zhou1, Tao
Tao.Zhou1 at amd.com
Thu Dec 21 07:48:30 UTC 2023
[AMD Official Use Only - General]
Reviewed-by: Tao Zhou <tao.zhou1 at amd.com>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Srinivasan
> Shanmugam
> Sent: Tuesday, December 19, 2023 10:12 PM
> To: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian
> <Christian.Koenig at amd.com>
> Cc: SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM at amd.com>; amd-
> gfx at lists.freedesktop.org
> Subject: [PATCH] drm/amdgpu: Use kzalloc instead of kmalloc+__GFP_ZERO in
> amdgpu_ras.c
>
> Fixes the below smatch warnings:
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:2543 amdgpu_ras_recovery_init()
> warn: Please consider using kzalloc instead of kmalloc
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:2830 amdgpu_ras_init() warn:
> Please consider using kzalloc instead of kmalloc
>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index bad62141f708..e541e6925918 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -2540,7 +2540,7 @@ int amdgpu_ras_recovery_init(struct amdgpu_device
> *adev)
> return 0;
>
> data = &con->eh_data;
> - *data = kmalloc(sizeof(**data), GFP_KERNEL | __GFP_ZERO);
> + *data = kzalloc(sizeof(**data), GFP_KERNEL);
> if (!*data) {
> ret = -ENOMEM;
> goto out;
> @@ -2827,10 +2827,10 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
> if (con)
> return 0;
>
> - con = kmalloc(sizeof(struct amdgpu_ras) +
> + con = kzalloc(sizeof(*con) +
> sizeof(struct ras_manager) *
> AMDGPU_RAS_BLOCK_COUNT +
> sizeof(struct ras_manager) *
> AMDGPU_RAS_MCA_BLOCK_COUNT,
> - GFP_KERNEL|__GFP_ZERO);
> + GFP_KERNEL);
> if (!con)
> return -ENOMEM;
>
> --
> 2.34.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 16126 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20231221/93a15bfa/attachment-0001.bin>
More information about the amd-gfx
mailing list