Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933689AbbLOSWQ (ORCPT ); Tue, 15 Dec 2015 13:22:16 -0500 Received: from smtprelay0202.hostedemail.com ([216.40.44.202]:43443 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933560AbbLOSWO (ORCPT ); Tue, 15 Dec 2015 13:22:14 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:152:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3870:3871:3872:3873:4321:5007:6261:10004:10400:10848:11232:11658:11914:12219:12517:12519:12740:13069:13311:13357:13894:14096:14097:14659:21080:30012:30054:30064:30074: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:4,LUA_SUMMARY:none X-HE-Tag: room64_6a155cbc91b46 X-Filterd-Recvd-Size: 2463 Message-ID: <1450203727.4142.13.camel@perches.com> Subject: Re: staging: lustre: Delete unnecessary goto statements in six functions From: Joe Perches To: SF Markus Elfring , Dan Carpenter Cc: Andreas Dilger , Greg Kroah-Hartman , Oleg Drokin , lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, LKML , kernel-janitors@vger.kernel.org, Julia Lawall Date: Tue, 15 Dec 2015 10:22:07 -0800 In-Reply-To: <567055C4.8000806@users.sourceforge.net> References: <566ABCD9.1060404@users.sourceforge.net> <566D7733.1030102@users.sourceforge.net> <566D7830.9060000@users.sourceforge.net> <1450189676.3551.1.camel@perches.com> <20151215144133.GC5284@mwanda> <1450191751.3551.14.camel@perches.com> <567055C4.8000806@users.sourceforge.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.2-0ubuntu2 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 Content-Length: 1315 Lines: 64 On Tue, 2015-12-15 at 19:02 +0100, SF Markus Elfring wrote: > > This is the original code: > Really …? > > result = baz(); > > if (result) > > goto label; > > > > label: > > go on... > > I do not see such a source code structure > at the six places I propose to clean-up. > > > > I don't find the test->goto label; label: use offensive, > > but if he does, I think keeping a blank line in place of > > the test->goto might be better. > > I find this an interesting view on source code layout. > Are there any more opinions around such implementation details? Or to put it another way, use a blank line before the first or only label in an error/out block. I don't find it different then commonly written blocks like: void foo(void) { ...; wind1(); val = func1(...); if (val) { printk(...); goto err_type; } wind2(); val = func2(...); if (val) { printk(...); goto err_type2; } ... return 0; err_type2: unwind2(); err_type: unwind1(); return -ERR; } Yes, you can elide all the blank lines, but using them can help readability. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/