aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRakib Mullick <rakib.mullick@gmail.com>2011-05-26 19:25:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 20:12:37 -0400
commit658c74cf3c98b1c9bc21e26731052db66251dfd8 (patch)
tree9fecd1f438aa8fec724bf4ff2d8927c322da7f13 /drivers/char
parent074127367a503de0168e2ca5d0b36a6f761f026a (diff)
drivers/char/mspec.c: use {k,v}zalloc to allocate memory
Let memory allocator initialize the allocated memory as null, thus remove the use of memset. Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/mspec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 966a95bc974b..25d139c9dbed 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,
271 pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 271 pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
272 vdata_size = sizeof(struct vma_data) + pages * sizeof(long); 272 vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
273 if (vdata_size <= PAGE_SIZE) 273 if (vdata_size <= PAGE_SIZE)
274 vdata = kmalloc(vdata_size, GFP_KERNEL); 274 vdata = kzalloc(vdata_size, GFP_KERNEL);
275 else { 275 else {
276 vdata = vmalloc(vdata_size); 276 vdata = vzalloc(vdata_size);
277 flags = VMD_VMALLOCED; 277 flags = VMD_VMALLOCED;
278 } 278 }
279 if (!vdata) 279 if (!vdata)
280 return -ENOMEM; 280 return -ENOMEM;
281 memset(vdata, 0, vdata_size);
282 281
283 vdata->vm_start = vma->vm_start; 282 vdata->vm_start = vma->vm_start;
284 vdata->vm_end = vma->vm_end; 283 vdata->vm_end = vma->vm_end;