From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758820AbcLPTTl (ORCPT ); Fri, 16 Dec 2016 14:19:41 -0500 Received: from smtprelay0031.hostedemail.com ([216.40.44.31]:51087 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758776AbcLPTTd (ORCPT ); Fri, 16 Dec 2016 14:19:33 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:871:968:973:982:988:989:1000:1260:1313:1314:1345:1359:1373:1437:1516:1518:1534:1542:1575:1594:1711:1730:1747:1764:1777:1792:2198:2199:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3354:3622:3653:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6506:6747:6748:7281:7909:10004:10394:10400:10848:11026:11232:11473:11604:11657:11658:11914:12043:12296:12438:12555:12740:12895:13439:14181:14659:14721:21080:21433:21451:30022:30054:30056:30070: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:3,LUA_SUMMARY:none X-HE-Tag: push21_8c8da082a4f23 X-Filterd-Recvd-Size: 4983 Message-ID: <1481915962.29291.96.camel@perches.com> Subject: Re: [PATCH] staging : lustre : Remove braces from single-line body. From: Joe Perches To: Dan Carpenter Cc: Tabrez khan , oleg.drokin@intel.com, jsimmons@infradead.org, andreas.dilger@intel.com, devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, lustre-devel@lists.lustre.org Date: Fri, 16 Dec 2016 11:19:22 -0800 In-Reply-To: <20161216185355.GH8176@mwanda> References: <1481911175-19592-1-git-send-email-khan.tabrez21@gmail.com> <1481913804.29291.92.camel@perches.com> <20161216185355.GH8176@mwanda> Content-Type: multipart/mixed; boundary="=-6a0Q+ZsOxmbBlgNaJgNg" X-Mailer: Evolution 3.22.1-0ubuntu2 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-6a0Q+ZsOxmbBlgNaJgNg Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit On Fri, 2016-12-16 at 21:53 +0300, Dan Carpenter wrote: > On Fri, Dec 16, 2016 at 10:43:24AM -0800, Joe Perches wrote: > > On Fri, 2016-12-16 at 23:29 +0530, Tabrez khan wrote: > > > Remove unnecessary braces {} from single line if statement. > > > This warning is found using checkpatch.pl. > > > > [] > > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c > > > > [] > > > @@ -1134,9 +1134,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, > > > } > > > > > > /* Sanity checks for a reconnected import. */ > > > - if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) { > > > + if (!(imp->imp_replayable) != !(msg_flags & MSG_CONNECT_REPLAYABLE)) > > > CERROR("imp_replayable flag does not match server after reconnect. We should LBUG right here.\n"); > > > - } > > > + > > > > There are one too many blank lines now. > > I was expecting checkpatch.pl to catch the extra blank. It was there in > the last patch as well. Apparently it doesn't. checkpatch is imperfect and always will be. checkpatch is a stupid little script. It mostly works on added lines and generally only looks for style defects on lines that precede those added lines. Here the now unnecessary blank line follows the added blank line. Oh well. Anyway, here's an almost completely untested possible patch to checkpatch. (also attached because evolution is a terrible email client, but I seem to be stuck with it) --- scripts/checkpatch.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 1579230ebacc..97078f7629e2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3063,6 +3063,19 @@ sub process { $last_blank_line = $linenr; } +# Another check for multiple consecutive blank lines where the following +# line is part of the context and is also blank + if ($line =~ /^\+\s*$/ && + defined $rawlines[$linenr] && + $rawlines[$linenr] =~ /^ \s*$/) { + if (CHK("LINE_SPACING", + "Please don't use multiple blank lines\n" . $hereprev) && + $fix) { + fix_delete_line($fixlinenr, $rawline); + } + $last_blank_line = $linenr; + } + # check for missing blank lines after declarations if ($sline =~ /^\+\s+\S/ && #Not at char 1 # actual declarations --=-6a0Q+ZsOxmbBlgNaJgNg Content-Disposition: attachment; filename="cp_trailing_context_blank.diff" Content-Type: text/x-patch; name="cp_trailing_context_blank.diff"; charset="ISO-8859-1" Content-Transfer-Encoding: base64 IHNjcmlwdHMvY2hlY2twYXRjaC5wbCB8IDEzICsrKysrKysrKysrKysKIDEgZmlsZSBjaGFuZ2Vk LCAxMyBpbnNlcnRpb25zKCspCgpkaWZmIC0tZ2l0IGEvc2NyaXB0cy9jaGVja3BhdGNoLnBsIGIv c2NyaXB0cy9jaGVja3BhdGNoLnBsCmluZGV4IDE1NzkyMzBlYmFjYy4uOTcwNzhmNzYyOWUyIDEw MDc1NQotLS0gYS9zY3JpcHRzL2NoZWNrcGF0Y2gucGwKKysrIGIvc2NyaXB0cy9jaGVja3BhdGNo LnBsCkBAIC0zMDYzLDYgKzMwNjMsMTkgQEAgc3ViIHByb2Nlc3MgewogCQkJJGxhc3RfYmxhbmtf bGluZSA9ICRsaW5lbnI7CiAJCX0KIAorIyBBbm90aGVyIGNoZWNrIGZvciBtdWx0aXBsZSBjb25z ZWN1dGl2ZSBibGFuayBsaW5lcyB3aGVyZSB0aGUgZm9sbG93aW5nCisjIGxpbmUgaXMgcGFydCBv ZiB0aGUgY29udGV4dCBhbmQgaXMgYWxzbyBibGFuaworCQlpZiAoJGxpbmUgPX4gL15cK1xzKiQv ICYmCisJCSAgICBkZWZpbmVkICRyYXdsaW5lc1skbGluZW5yXSAmJgorCQkgICAgJHJhd2xpbmVz WyRsaW5lbnJdID1+IC9eIFxzKiQvKSB7C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