Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4686802imu; Sat, 1 Dec 2018 00:34:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/XQ3Au5+HUHseUvMHVVFkM9CbW3c9vV7GvV6FaQtTy8Kg0xbOR5fCCkwuZrFwuSlaP/6+zC X-Received: by 2002:a65:448a:: with SMTP id l10mr6113940pgq.387.1543653282179; Sat, 01 Dec 2018 00:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543653282; cv=none; d=google.com; s=arc-20160816; b=MLwLHoRVL4JFzfSQD/oY5XQpSFn0XoSHU03khSTcGVNhzHnAk80KrbLGW2Pllrnyp7 4/SHsAsrMLPE2QiQ0avy6LvxAEqTjtA5+H8SVC0AOZZLob3jNj00m7vPaYxQ0t0No941 UHBzwxHKhMlbuZ1gdNBhStDz63tzVL3q+zI741bG01PCiGE9ExPlmbpk2rbJSJ0kan5g QEdq7cygYeB/jl42xoCQyIyD8Bats+GkKpAhdcCo++//d5EWDqAbsECZCUUQ8T4/vMjy CGOTBwjql33oYpNUjD1SqxidTBBBRDw+Ojb/6RJbOwnJ0SSX9rMgi1yfNpTkNaWQdDUn QC8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=lADdA7KsB9FW8bOGuQekOmKDc8lKdfF/Ro9gPuibMJ4=; b=lPLieTlkUpLyxfBOLP8GfhXVRnx/JI9evBkLA/wS2WC50SzUwJXyUiJ8Nwg5qk40tq pcw3FSz8RFAtkXk4x4PumWwjIsILksgzFChYfWU52g2+9adWUwjFa4sWu8dPyMQA9OK1 M5Zh9+2ezwFsrrvCAZ5XPvafe7ZDlOR6+sRZf4wd6KNqpWQtpyePfMh/BpQywu5GWbKz yTNdI1r3xRpzdk5FnGMyvW2+z3yE+uguWrhCb/yfHcy7waYzt0XgS+Tbr5UU7diPY9/8 lxnv6VCHIupeZNWokJ4iCxC4q0ezEOteuVJSzJkSEXgpU9YZ/8iI9VtgBwcvlIsNPdeD uF+Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l5si7714518plt.5.2018.12.01.00.34.27; Sat, 01 Dec 2018 00:34:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbeLATn6 (ORCPT + 99 others); Sat, 1 Dec 2018 14:43:58 -0500 Received: from mxhk.zte.com.cn ([63.217.80.70]:17554 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbeLATn6 (ORCPT ); Sat, 1 Dec 2018 14:43:58 -0500 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 643DAA238FD1CD828C72; Sat, 1 Dec 2018 16:31:58 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wB18Vrgm052595; Sat, 1 Dec 2018 16:31:53 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from LIN-A6CB96A0603.zte.intra ([10.90.106.118]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018120116323995-14110856 ; Sat, 1 Dec 2018 16:32:39 +0800 From: Wen Yang To: Davidlohr Bueso , paulmck@linux.ibm.com, Josh Triplett Cc: linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, Wen Yang Subject: [PATCH] locktorture: Fix assignment of boolean variables Date: Sat, 1 Dec 2018 16:31:49 +0800 Message-Id: <20181201083149.36972-1-wen.yang99@zte.com.cn> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-12-01 16:32:40, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-12-01 16:31:34 Content-Transfer-Encoding: quoted-printable X-MAIL: mse01.zte.com.cn wB18Vrgm052595 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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=5Ftorture=5Fwriter(void *arg) cxt.cur=5Fops->writelock(); if (WARN=5FON=5FONCE(lock=5Fis=5Fwrite=5Fheld)) lwsp->n=5Flock=5Ffail++; - lock=5Fis=5Fwrite=5Fheld =3D 1; + lock=5Fis=5Fwrite=5Fheld =3D true; if (WARN=5FON=5FONCE(lock=5Fis=5Fread=5Fheld)) lwsp->n=5Flock=5Ffail++; /* rare, but... */ =20 lwsp->n=5Flock=5Facquired++; cxt.cur=5Fops->write=5Fdelay(&rand); - lock=5Fis=5Fwrite=5Fheld =3D 0; + lock=5Fis=5Fwrite=5Fheld =3D false; cxt.cur=5Fops->writeunlock(); =20 stutter=5Fwait("lock=5Ftorture=5Fwriter"); @@ -679,13 +679,13 @@ static int lock=5Ftorture=5Freader(void *arg) schedule=5Ftimeout=5Funinterruptible(1); =20 cxt.cur=5Fops->readlock(); - lock=5Fis=5Fread=5Fheld =3D 1; + lock=5Fis=5Fread=5Fheld =3D true; if (WARN=5FON=5FONCE(lock=5Fis=5Fwrite=5Fheld)) lrsp->n=5Flock=5Ffail++; /* rare, but... */ =20 lrsp->n=5Flock=5Facquired++; cxt.cur=5Fops->read=5Fdelay(&rand); - lock=5Fis=5Fread=5Fheld =3D 0; + lock=5Fis=5Fread=5Fheld =3D false; cxt.cur=5Fops->readunlock(); =20 stutter=5Fwait("lock=5Ftorture=5Freader"); @@ -700,7 +700,7 @@ static int lock=5Ftorture=5Freader(void *arg) static void =5F=5Ftorture=5Fprint=5Fstats(char *page, struct lock=5Fstress=5Fstats *statp, bool write) { - bool fail =3D 0; + bool fail =3D false; int i, n=5Fstress; long max =3D 0, min =3D statp ? statp[0].n=5Flock=5Facquired : 0; long long sum =3D 0; @@ -915,7 +915,7 @@ static int =5F=5Finit lock=5Ftorture=5Finit(void) =20 /* Initialize the statistics so that each run gets its own numbers. */ if (nwriters=5Fstress) { - lock=5Fis=5Fwrite=5Fheld =3D 0; + lock=5Fis=5Fwrite=5Fheld =3D false; cxt.lwsa =3D kmalloc=5Farray(cxt.nrealwriters=5Fstress, sizeof(*cxt.lwsa), GFP=5FKERNEL); @@ -946,7 +946,7 @@ static int =5F=5Finit lock=5Ftorture=5Finit(void) } =20 if (nreaders=5Fstress) { - lock=5Fis=5Fread=5Fheld =3D 0; + lock=5Fis=5Fread=5Fheld =3D false; cxt.lrsa =3D kmalloc=5Farray(cxt.nrealreaders=5Fstress, sizeof(*cxt.lrsa), GFP=5FKERNEL); --=20 2.19.1