Skip to contentSkip to conversation

drm/amdgpu: modify kmalloc to kzalloc in amdgpu_ctx_init_entity

PATCH In review Changfeng 2 participants 2 messages Oct 9, 2020

Subsystems (2)
lore
Share & tools
lore

Changfeng

author
#0 lore raw

PATCH 1/1 drm/amdgpu: modify kmalloc to kzalloc in amdgpu_ctx_init_entity

From: changzhu <[email protected]>

From: Changfeng <[email protected]>

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

Change-Id I3a73d3f943f4409e6bfbadb0237db3f649d831e9
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -1
index 5be125f3b92a..a03398c87344 100644
@@ -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;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 09.10.20 um 11:04 schrieb Changfeng:

Quoted 9 lines

From: changzhu <[email protected]>

From: Changfeng <[email protected]>

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

Change-Id I3a73d3f943f4409e6bfbadb0237db3f649d831e9
Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 -0
index 5be125f3b92a..a03398c87344 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c static int amdgpu_ctx_init_entity(struct amdgpu_ctx *ctx, u32 hw_ip, · line 106

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -1
@@ -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;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx