Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752618AbdGHA6f (ORCPT ); Fri, 7 Jul 2017 20:58:35 -0400 Received: from smtprelay0124.hostedemail.com ([216.40.44.124]:38161 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751034AbdGHA6e (ORCPT ); Fri, 7 Jul 2017 20:58:34 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:960:965:966:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1381:1431:1437:1515:1516:1518:1534:1539:1593:1594:1711:1714:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3351:3622:3865:3866:3867:3868:4321:4385:4390:4395:5007:6119:7903:8603:8660:10004:10400:10848:11026:11232:11657:11658:11914:12043:12048:12740:12760:12895:13069:13148:13230:13255:13311:13357:13439:14659:21080:21627:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: trail05_4a8a3863f1a1d X-Filterd-Recvd-Size: 1546 Message-ID: <1499475510.20988.12.camel@perches.com> Subject: Re: [PATCH 1/2] staging: media: atomisp2: css2400: Replace kfree()/vfree() with kvfree() From: Joe Perches To: Amitoj Kaur Chawla , mchehab@kernel.org, gregkh@linuxfoundation.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Fri, 07 Jul 2017 17:58:30 -0700 In-Reply-To: <20170708004054.GA27142@amitoj-Inspiron-3542> References: <20170708004054.GA27142@amitoj-Inspiron-3542> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 666 Lines: 20 On Fri, 2017-07-07 at 20:40 -0400, Amitoj Kaur Chawla wrote: > Conditionally calling kfree()/vfree() can be replaced by a call to > kvfree() which handles both kmalloced memory and vmalloced memory. [] > diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c [] > @@ -2029,10 +2029,7 @@ void *sh_css_calloc(size_t N, size_t size) > > void sh_css_free(void *ptr) > { > - if (is_vmalloc_addr(ptr)) > - vfree(ptr); > - else > - kfree(ptr); > + kvfree(ptr); > } Why not just get rid of sh_css_free and use kvfree directly? Why not get rid of all the sh_css_ functions?