Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5261010imu; Sat, 1 Dec 2018 12:38:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vn3mZyCf+m+MrmURtrz4PwkHeS449zuCroIUeesFyqTOHNA9z6p8CaakvYjaS2hfnBSpN7 X-Received: by 2002:a63:7044:: with SMTP id a4mr7458857pgn.359.1543696703910; Sat, 01 Dec 2018 12:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543696703; cv=none; d=google.com; s=arc-20160816; b=rr6IT3rwF2/UlPh5O348egroSpUJKW5u/i6oYThDki3iyIbcNdrP++4WmDv2mi+74p rcd8yqgX+S2q8UYEohYDiMlnOXmrMmuTizSLEol7JHxL+JhweN3aqB45QCGoY2Uh2qOh dBoLZUWOBuIa4xKmvI0MQg0wGxjsZbTEsGXllV80jK0t9OEstX9oUd6gOOvW0qg39px9 zEgcPP5RRF2AOS7Z5U8ekeHKAiruvcaY90MFDt05XR6JzjvgZOeUbAGKGv+ROaD3rLzB AfB/d9jbQae8GaOtIqmolT1mug2CcrKtBwOCnN9Jzs0otX1CRi5qroSd7xOTxGCiJZ4p 4FWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=aVR3CfHlkeiWfZvPgWBctTy1lP/UC/kO0kGiEwQaLOo=; b=WrFGLwDNt/7z6qWcNG3QZVOWmS9iQvobksmLd88Vz7qfrGBv4zQX4kUXyfL3xx9M3B eLnQ+RpUSpKis3+xQBDuDSS8Vx3D2Bb4+dRwnc5MDrjkWzyN6pSCSwv7qqe4dQbO7VsU JZE41/TRcPn9KUQnCumHiZnepyK2a5Frqve6+124QYZWEeHcurB7BSeENL0xvgqHwrsa shTJI7q7h+vydR4DPRETBNF3hSE8GousNtCk1VO8O271FbTvaB90bVBHplWSTjfppPm0 BBE9J4Xol1jwyOg5xnAX9T/MfC5yfiJyetFDY56Wa6MVPHxOxBE9qGKMjzzhr3HtSkYg JR3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si9350798pli.266.2018.12.01.12.38.09; Sat, 01 Dec 2018 12:38:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725766AbeLBHua (ORCPT + 99 others); Sun, 2 Dec 2018 02:50:30 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45818 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725726AbeLBHu3 (ORCPT ); Sun, 2 Dec 2018 02:50:29 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wB1KXcvA092617 for ; Sat, 1 Dec 2018 15:37:08 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p41ay08r4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 01 Dec 2018 15:37:08 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 1 Dec 2018 20:37:06 -0000 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 1 Dec 2018 20:37:02 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wB1Kb1Ol14942440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 1 Dec 2018 20:37:01 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AC88B2065; Sat, 1 Dec 2018 20:37:01 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D875EB205F; Sat, 1 Dec 2018 20:37:00 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.80.206.214]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Sat, 1 Dec 2018 20:37:00 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 092A616C1B3E; Sat, 1 Dec 2018 12:37:01 -0800 (PST) Date: Sat, 1 Dec 2018 12:37:01 -0800 From: "Paul E. McKenney" To: Wen Yang Cc: Davidlohr Bueso , Josh Triplett , linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, peterz@infradead.org, mingo@redhat.com, will.deacon@arm.com Subject: Re: [PATCH] locktorture: Fix assignment of boolean variables Reply-To: paulmck@linux.ibm.com References: <20181201083149.36972-1-wen.yang99@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181201083149.36972-1-wen.yang99@zte.com.cn> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18120120-2213-0000-0000-00000322EBD2 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010154; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01125568; UDB=6.00584482; IPR=6.00905696; MB=3.00024410; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-01 20:37:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18120120-2214-0000-0000-00005C73FF8F Message-Id: <20181201203700.GW4170@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-01_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812010190 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 01, 2018 at 04:31:49PM +0800, Wen Yang wrote: > Fix the following warnings reported by coccinelle: > > kernel/locking/locktorture.c:703:6-10: WARNING: Assignment of bool to 0/1 > kernel/locking/locktorture.c:918:2-20: WARNING: Assignment of bool to 0/1 > kernel/locking/locktorture.c:949:3-20: WARNING: Assignment of bool to 0/1 > kernel/locking/locktorture.c:682:2-19: WARNING: Assignment of bool to 0/1 > kernel/locking/locktorture.c:688:2-19: WARNING: Assignment of bool to 0/1 > kernel/locking/locktorture.c:648:2-20: WARNING: Assignment of bool to 0/1 > kernel/locking/locktorture.c:654:2-20: WARNING: Assignment of bool to 0/1 > > This patch also makes the code more readable. > > Signed-off-by: Wen Yang > CC: Davidlohr Bueso > CC: "Paul E. McKenney" > CC: Josh Triplett > CC: linux-kernel@vger.kernel.org Adding the current maintainers on CC. Thanx, Paul > --- > kernel/locking/locktorture.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c > index 7d0b0ed74404..cd95c01491d8 100644 > --- a/kernel/locking/locktorture.c > +++ b/kernel/locking/locktorture.c > @@ -645,13 +645,13 @@ static int lock_torture_writer(void *arg) > cxt.cur_ops->writelock(); > if (WARN_ON_ONCE(lock_is_write_held)) > lwsp->n_lock_fail++; > - lock_is_write_held = 1; > + lock_is_write_held = true; > if (WARN_ON_ONCE(lock_is_read_held)) > lwsp->n_lock_fail++; /* rare, but... */ > > lwsp->n_lock_acquired++; > cxt.cur_ops->write_delay(&rand); > - lock_is_write_held = 0; > + lock_is_write_held = false; > cxt.cur_ops->writeunlock(); > > stutter_wait("lock_torture_writer"); > @@ -679,13 +679,13 @@ static int lock_torture_reader(void *arg) > schedule_timeout_uninterruptible(1); > > cxt.cur_ops->readlock(); > - lock_is_read_held = 1; > + lock_is_read_held = true; > if (WARN_ON_ONCE(lock_is_write_held)) > lrsp->n_lock_fail++; /* rare, but... */ > > lrsp->n_lock_acquired++; > cxt.cur_ops->read_delay(&rand); > - lock_is_read_held = 0; > + lock_is_read_held = false; > cxt.cur_ops->readunlock(); > > stutter_wait("lock_torture_reader"); > @@ -700,7 +700,7 @@ static int lock_torture_reader(void *arg) > static void __torture_print_stats(char *page, > struct lock_stress_stats *statp, bool write) > { > - bool fail = 0; > + bool fail = false; > int i, n_stress; > long max = 0, min = statp ? statp[0].n_lock_acquired : 0; > long long sum = 0; > @@ -915,7 +915,7 @@ static int __init lock_torture_init(void) > > /* Initialize the statistics so that each run gets its own numbers. */ > if (nwriters_stress) { > - lock_is_write_held = 0; > + lock_is_write_held = false; > cxt.lwsa = kmalloc_array(cxt.nrealwriters_stress, > sizeof(*cxt.lwsa), > GFP_KERNEL); > @@ -946,7 +946,7 @@ static int __init lock_torture_init(void) > } > > if (nreaders_stress) { > - lock_is_read_held = 0; > + lock_is_read_held = false; > cxt.lrsa = kmalloc_array(cxt.nrealreaders_stress, > sizeof(*cxt.lrsa), > GFP_KERNEL); > -- > 2.19.1 >