char: mspec: Use kvzalloc() in mspec_mmap()
diff mbox series

Message ID 20200827213421.50429-1-efremov@linux.com
State Accepted
Commit fe69795e84a553b838504e0acdb4a57c3fbdd200
Headers show
Series
  • char: mspec: Use kvzalloc() in mspec_mmap()
Related show

Commit Message

Denis Efremov Aug. 27, 2020, 9:34 p.m. UTC
Use kvzalloc() in mspec_mmap() instead of open-coding it.

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/char/mspec.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 0fae33319d2e..f8231e2e84be 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -195,10 +195,7 @@  mspec_mmap(struct file *file, struct vm_area_struct *vma,
 
 	pages = vma_pages(vma);
 	vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
-	if (vdata_size <= PAGE_SIZE)
-		vdata = kzalloc(vdata_size, GFP_KERNEL);
-	else
-		vdata = vzalloc(vdata_size);
+	vdata = kvzalloc(vdata_size, GFP_KERNEL);
 	if (!vdata)
 		return -ENOMEM;