public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] char: mspec: Use kvzalloc() in mspec_mmap()
@ 2020-08-27 21:34 Denis Efremov
  0 siblings, 0 replies; only message in thread
From: Denis Efremov @ 2020-08-27 21:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Denis Efremov, Arnd Bergmann, linux-kernel

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(-)

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;
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-27 21:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-27 21:34 [PATCH] char: mspec: Use kvzalloc() in mspec_mmap() Denis Efremov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox