Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934727AbdCWNM7 (ORCPT ); Thu, 23 Mar 2017 09:12:59 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:32826 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934688AbdCWNM5 (ORCPT ); Thu, 23 Mar 2017 09:12:57 -0400 From: Geliang Tang To: Mauro Carvalho Chehab , Greg Kroah-Hartman , Daeseok Youn , Alan Cox , Dan Carpenter , simran singhal Cc: Geliang Tang , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: media: atomisp: use kvmalloc and kvfree Date: Thu, 23 Mar 2017 21:12:39 +0800 Message-Id: <7ac949fbedccaa86c27db0dd045f10be97ec74b1.1490261637.git.geliangtang@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <328d0eb3da461aaaa6140b1409ee7550bcec87bb.1490261279.git.geliangtang@gmail.com> References: <328d0eb3da461aaaa6140b1409ee7550bcec87bb.1490261279.git.geliangtang@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1078 Lines: 37 Use kvmalloc() and kvfree() instead of open-coding. Signed-off-by: Geliang Tang --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 94bc793..c7b9320 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -90,10 +90,7 @@ union host { void *atomisp_kernel_malloc(size_t bytes) { /* vmalloc() is preferable if allocating more than 1 page */ - if (bytes > PAGE_SIZE) - return vmalloc(bytes); - - return kmalloc(bytes, GFP_KERNEL); + return kvmalloc(bytes, GFP_KERNEL); } /* @@ -118,10 +115,7 @@ void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem) void atomisp_kernel_free(void *ptr) { /* Verify if buffer was allocated by vmalloc() or kmalloc() */ - if (is_vmalloc_addr(ptr)) - vfree(ptr); - else - kfree(ptr); + kvfree(ptr); } /* -- 2.9.3