* [PATCH] drivers, char: Use {k,v}zalloc to allocate memory
@ 2011-04-25 16:39 Rakib Mullick
0 siblings, 0 replies; only message in thread
From: Rakib Mullick @ 2011-04-25 16:39 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Arnd Bergmann
Let memory allocator initialize the allocated memory as null, thus
remove the use of memset.
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 966a95b..25d139c 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -271,14 +271,13 @@ mspec_mmap(struct file *file, struct
vm_area_struct *vma,
pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
if (vdata_size <= PAGE_SIZE)
- vdata = kmalloc(vdata_size, GFP_KERNEL);
+ vdata = kzalloc(vdata_size, GFP_KERNEL);
else {
- vdata = vmalloc(vdata_size);
+ vdata = vzalloc(vdata_size);
flags = VMD_VMALLOCED;
}
if (!vdata)
return -ENOMEM;
- memset(vdata, 0, vdata_size);
vdata->vm_start = vma->vm_start;
vdata->vm_end = vma->vm_end;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-25 16:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-25 16:39 [PATCH] drivers, char: Use {k,v}zalloc to allocate memory Rakib Mullick
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox