drm/amdgpu: remove redundant memset
Subsystems (2)
PATCH 1/1 drm/amdgpu: remove redundant memset
kvmalloc_array uses __GFP_ZERO flag ensures that the returned address is zeroed already, memset it to zero again afterwards is unnecessary, and in this case buggy because we only clear the first entry.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
@@ -540,7 +540,6 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, GFP_KERNEL | __GFP_ZERO);if (!parent->entries)return -ENOMEM ; -memset (parent->entries,0 ,sizeof (struct amdgpu_vm_pt )); } from = saddr >> shift;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1535555864-2521-1-git-send-email-Philip.Yang-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Reviewed-by________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Philip Yang <[email protected]>
Sent: Wednesday, August 29, 2018 11:17:44 AM
To: [email protected]
Cc: Yang, Philip
Subject: [PATCH] drm/amdgpu: remove redundant memset
kvmalloc_array uses __GFP_ZERO flag ensures that the returned address is zeroed already, memset it to zero again afterwards is unnecessary, and in this case buggy because we only clear the first entry.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0 -1
@@ -540,7 +540,6 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, GFP_KERNEL | __GFP_ZERO);if (!parent->entries)return -ENOMEM ; -memset (parent->entries,0 ,sizeof (struct amdgpu_vm_pt )); } from = saddr >> shift;
--
2.7.4
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Zhang, Jerry (Junwei)
Reviewed-by Junwei ZhangQuoted 6 lines · Philip Yang
kvmalloc_arrayuses__GFP_ZEROflag ensures that the returned address is zeroed already, memset it to zero again afterwards is unnecessary, and in this case buggy because we only clear the first entry.Change-Id If94a59d3cbf2690dd2a1e2add71bc393df6a9686Signed-off-by Philip Yang <[email protected]>
Good catch.
Quoted 10 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, · line 545
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-1@@ -540,7 +540,6 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, GFP_KERNEL | __GFP_ZERO);if (!parent->entries)return -ENOMEM ; -memset (parent->entries,0 ,sizeof (struct amdgpu_vm_pt )); } from = saddr >> shift;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx