Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751299AbdCZBS4 (ORCPT ); Sat, 25 Mar 2017 21:18:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:32788 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751218AbdCZBSz (ORCPT ); Sat, 25 Mar 2017 21:18:55 -0400 Date: Sat, 25 Mar 2017 16:36:21 -0700 From: "Paul E. McKenney" To: Nicholas Mc Guire Cc: Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] rcu: use bool value directly Reply-To: paulmck@linux.vnet.ibm.com References: <1490471162-21390-1-git-send-email-der.herr@hofr.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1490471162-21390-1-git-send-email-der.herr@hofr.at> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17032523-0044-0000-0000-000002E86D7D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006849; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000206; SDB=6.00838768; UDB=6.00412565; IPR=6.00616629; BA=6.00005235; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014810; XFM=3.00000013; UTC=2017-03-25 23:36:23 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17032523-0045-0000-0000-000007166F8D Message-Id: <20170325233621.GT3637@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-25_22:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703250218 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1292 Lines: 42 On Sat, Mar 25, 2017 at 08:46:01PM +0100, Nicholas Mc Guire wrote: > beenonline is declared bool so no need for an explicit comparison > > Signed-off-by: Nicholas Mc Guire Queued both for review and testing, thank you! Thanx, Paul > --- > > Found by coccinelle: boolinit.cocci complained about > ./kernel/rcu/tree.c:2986:14-29: WARNING: Comparison of bool to 0/1 > > If the comparison was intended for readability I guess it should be > against "false" not 0 - but it seems common to just use bool values > directly. > > Patch was compile-tested with: x86_64_defconfig (implies CONFIG_TREE_RCU=y) > (with some sparse warnings) > > Patch is against 4.11-rc3 (localversion-next is next-20170324) > > kernel/rcu/tree.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index 712ddce..ab9fbec 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -2983,7 +2983,7 @@ __rcu_process_callbacks(struct rcu_state *rsp) > bool needwake; > struct rcu_data *rdp = raw_cpu_ptr(rsp->rda); > > - WARN_ON_ONCE(rdp->beenonline == 0); > + WARN_ON_ONCE(!rdp->beenonline); > > /* Update RCU state based on any recent quiescent states. */ > rcu_check_quiescent_state(rsp, rdp); > -- > 2.1.4 >