From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757080AbcAOMD4 (ORCPT ); Fri, 15 Jan 2016 07:03:56 -0500 Received: from smtprelay0088.hostedemail.com ([216.40.44.88]:34063 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751709AbcAOMDx (ORCPT ); Fri, 15 Jan 2016 07:03:53 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:966:968:988:989:1042:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3873:3874:4321:4385:5007:6119:6261:7903:8700:10004:10400:10848:11026:11232:11473:11658:11783:11914:12114:12517:12519:12740:13069:13255:13311:13357:13894:14659:21080:21212:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:22,LUA_SUMMARY:none X-HE-Tag: cow17_3eab4389af55a X-Filterd-Recvd-Size: 2196 Message-ID: <1452859429.8586.52.camel@perches.com> Subject: Re: gianfar: Less function calls in gfar_ethflow_to_filer_table() after error detection From: Joe Perches To: SF Markus Elfring , netdev@vger.kernel.org Cc: Claudiu Manoil , LKML , kernel-janitors@vger.kernel.org, Julia Lawall Date: Fri, 15 Jan 2016 04:03:49 -0800 In-Reply-To: <5698DC52.4050808@users.sourceforge.net> References: <566ABCD9.1060404@users.sourceforge.net> <56866E7F.8080609@users.sourceforge.net> <5698C53C.8060204@users.sourceforge.net> <5698C5CB.80305@users.sourceforge.net> <1452854229.8586.48.camel@perches.com> <5698DC52.4050808@users.sourceforge.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.3-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2016-01-15 at 12:47 +0100, SF Markus Elfring wrote: > > > * Return directly if a memory allocation failed at the beginning. > > > > > > * Adjust jump targets according to the Linux coding style > > > convention. > > > > > > This issue was detected by using the Coccinelle software. > > > > Is this really better? > > > > Perhaps this particular static analysis isn't too useful. > > The opinions are still evolving for such a kind of search pattern. > > > > Why not just allocate once and assign a second pointer? > > > > local_rqfpr = kmalloc_array(2 * (MAX_FILER_IDX + 1), > >     sizeof(unsigned int), GFP_KERNEL); > > if (!local_rqfpr) > > goto err; > > > > local_rqfcr = &local_rqfpr[MAX_FILER_IDX + 1]; > > Do you suggest to use only one array (instead of two as before) here? That's a possibility. If, as your title suggests, you really want fewer function calls, (which as far as I saw, you didn't do) that could be a mechanism to remove both an allocation and a free.