Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754233AbbLOSKT (ORCPT ); Tue, 15 Dec 2015 13:10:19 -0500 Received: from smtprelay0243.hostedemail.com ([216.40.44.243]:40735 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753528AbbLOSKQ (ORCPT ); Tue, 15 Dec 2015 13:10:16 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:69:355:379:541:599:968:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2005:2110:2195:2198:2199:2200:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3871:3872:4321:4361:5007:6261:7264:7903:8604:9393:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12296:12438:12517:12519:12679:12740:13069:13161:13169:13229:13255:13311:13357:13894:14096:14097:14659:21080:30012:30054:30064:30079:30090: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:8,LUA_SUMMARY:none X-HE-Tag: fear06_1c7d622f3201 X-Filterd-Recvd-Size: 2536 Message-ID: <1450203011.4142.4.camel@perches.com> Subject: Re: [PATCH 1/7] staging: lustre: Delete unnecessary goto statements in six functions From: Joe Perches To: Dan Carpenter Cc: SF Markus Elfring , 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:10:11 -0800 In-Reply-To: <20151215174844.GE5284@mwanda> 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> <20151215174844.GE5284@mwanda> Content-Type: text/plain; charset="ISO-8859-1" 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: 1394 Lines: 66 On Tue, 2015-12-15 at 20:48 +0300, Dan Carpenter wrote: > On Tue, Dec 15, 2015 at 07:02:31AM -0800, Joe Perches wrote: > > This is the original code: > > > > result = foo(); > > if (result) > > goto label; > > > > result = bar(); > > if (result) > > goto label; > > > > result = baz(); > > if (result) > > goto label; > > > > label: > > go on... > > > > No.??There is no test.??The original code looks like: > > result = foo(); > if (result) > goto out; > result = baz(); > goto out; > out: > go on.. > > regards, > dan carpenter Here is the original code: --------------------- /* Copy hsm_progress struct */ req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS); if (req_hpk == NULL) { rc = -EPROTO; goto out; } *req_hpk = *hpk; req_hpk->hpk_errval = lustre_errno_hton(hpk->hpk_errval); ptlrpc_request_set_replen(req); rc = mdc_queue_wait(req); goto out; out: ptlrpc_req_finished(req); return rc; } --------------------- I think if the last goto out; is to be removed, then it should be replaced by a blank line. It separates the last operation block from the return. cheers, Joe -- 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/