diff options
author | Rakib Mullick <rakib.mullick@gmail.com> | 2011-05-26 16:25:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 17:12:37 -0700 |
commit | 658c74cf3c98b1c9bc21e26731052db66251dfd8 (patch) | |
tree | 9fecd1f438aa8fec724bf4ff2d8927c322da7f13 | |
parent | 074127367a503de0168e2ca5d0b36a6f761f026a (diff) | |
download | linux-stable-658c74cf3c98b1c9bc21e26731052db66251dfd8.tar.gz linux-stable-658c74cf3c98b1c9bc21e26731052db66251dfd8.tar.bz2 linux-stable-658c74cf3c98b1c9bc21e26731052db66251dfd8.zip |
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>
-rw-r--r-- | drivers/char/mspec.c | 5 |
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, 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; |