[PATCH] drm/amdgpu: modify kmalloc to kzalloc in amdgpu_ctx_init_entity

Changfeng Changfeng.Zhu at amd.com
Fri Oct 9 09:04:23 UTC 2020


From: changzhu <Changfeng.Zhu at amd.com>

From: Changfeng <Changfeng.Zhu at amd.com>

It's better to use kzalloc other than kmalloc to avoid unforeseen
consequences.

Change-Id: I3a73d3f943f4409e6bfbadb0237db3f649d831e9
Signed-off-by: Changfeng <Changfeng.Zhu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 5be125f3b92a..a03398c87344 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -100,7 +100,7 @@ static int amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, u32 hw_ip,
 	enum drm_sched_priority priority;
 	int r;
 
-	entity = kmalloc(struct_size(entity, fences, amdgpu_sched_jobs),
+	entity = kzalloc(struct_size(entity, fences, amdgpu_sched_jobs),
 			 GFP_KERNEL);
 	if (!entity)
 		return  -ENOMEM;
-- 
2.17.1



More information about the amd-gfx mailing list