From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Date: Fri, 16 Dec 2016 10:43:24 -0800 Subject: [lustre-devel] [PATCH] staging : lustre : Remove braces from single-line body. In-Reply-To: <1481911175-19592-1-git-send-email-khan.tabrez21@gmail.com> References: <1481911175-19592-1-git-send-email-khan.tabrez21@gmail.com> Message-ID: <1481913804.29291.92.camel@perches.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Tabrez khan , oleg.drokin@intel.com, jsimmons@infradead.org, andreas.dilger@intel.com Cc: gregkh@linuxfoundation.org, lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org 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. And that's an awful lot of !s. Generically, it might make simpler reading code to cast to bool instead of using !. Most code uses !! to make sure whatever value is either 0 or 1 without changing the logic/polarity. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932577AbcLPSoY (ORCPT ); Fri, 16 Dec 2016 13:44:24 -0500 Received: from smtprelay0140.hostedemail.com ([216.40.44.140]:45961 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755398AbcLPSoQ (ORCPT ); Fri, 16 Dec 2016 13:44:16 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:968:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3871:3872:3874:4250:4321:5007:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12048:12296:12438:12740:12760:12895:13069:13161:13229:13311:13357:13439:14181:14659:14721:21080:30012: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:6,LUA_SUMMARY:none X-HE-Tag: hat58_757c61d075504 X-Filterd-Recvd-Size: 1890 Message-ID: <1481913804.29291.92.camel@perches.com> Subject: Re: [PATCH] staging : lustre : Remove braces from single-line body. From: Joe Perches To: Tabrez khan , oleg.drokin@intel.com, jsimmons@infradead.org, andreas.dilger@intel.com Cc: gregkh@linuxfoundation.org, lustre-devel@lists.lustre.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Fri, 16 Dec 2016 10:43:24 -0800 In-Reply-To: <1481911175-19592-1-git-send-email-khan.tabrez21@gmail.com> References: <1481911175-19592-1-git-send-email-khan.tabrez21@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.1-0ubuntu2 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 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. And that's an awful lot of !s. Generically, it might make simpler reading code to cast to bool instead of using !. Most code uses !! to make sure whatever value is either 0 or 1 without changing the logic/polarity.