Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp173934ybz; Wed, 15 Apr 2020 06:41:15 -0700 (PDT) X-Google-Smtp-Source: APiQypLQXWPK5htuZtxD8CFn5G/084n/n7xMpNaVchbxhEbqxHQ7okGShYhA9zwab1KXns0r4zoG X-Received: by 2002:a17:906:841a:: with SMTP id n26mr5222149ejx.43.1586958075467; Wed, 15 Apr 2020 06:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586958075; cv=none; d=google.com; s=arc-20160816; b=Fe+cCw/46lKxq4nIdtguKpBEWDI85YLLQY93KjGAX9Coo5q/QSo5LozwAhXzj8IEVh 517LYiGOg271w4bW6aQb1Ratu7hcCai/xZe2opE0cVy1rt5gV+8Dy7YhZt24e+Efaq0g k4knsQPo2aO/nTv1xvNrzGS0V9IiY789MyAfXXaKDGMnwy6Y5dTwQTqgawazOJc7i22P GfHWiAg48catC6H1zJmeCFnUCRfVLFM0Zx6BxZVb3AZHh0ErnSM5MaW9Im9iWajGmklc Ewnor/gjKjJW/x9tm/k8S/QK/glvxuGw87vRTMGUGS197x5xv0ydDof7Ziyns+3CeLCN Igvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=ykfypz2fGC3QLUsJnSMCQwyiZAn4ff3xvbh4vb/J9e4=; b=qSYK8C7iwHqE7hrriN+36veZcXwndD7rlvlrLeTAxaQkTeLCNicYH3TzKpCO/WYzqp 8fOc2rsRvOV9jms2uMsgIQcj6q+gvQC+Ig+R7Q5RCQ1Cc1F51b2L7TTsjJ6vpry4NxVr +hFcZQz9vlIwsRh2ZLkvxjhH6gxd+wCzN+jVyXabGmsTbWhJF91v4BMlRsgcli3UcgdA v8gSSt8/vBKjMelN9QOM8kavhUTMLQ9qF1jnM5cAgG5h9LFyDmmR0yUAtwIqY+n18sbJ zRkRawTiYpbDEH804/gFj8HSbBTSjNyLaeXAhOpz08AgQKGPkjCQRlhAZGz7hcJ4CiuL u8nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A3kNqvQd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si8632387edr.94.2020.04.15.06.40.51; Wed, 15 Apr 2020 06:41:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A3kNqvQd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633505AbgDNU5v (ORCPT + 99 others); Tue, 14 Apr 2020 16:57:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:60648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2633482AbgDNU4p (ORCPT ); Tue, 14 Apr 2020 16:56:45 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4839120644; Tue, 14 Apr 2020 20:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586897804; bh=BBKaYlIjH81DUlBwwxmMyjGo3d8JBG5QNSGH9c0REEg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=A3kNqvQd7nwiKw3MNOI4MiR63Kmtcee046VFmXCFTC5Rk12jAQD8Eb7EkFZDaNgKb v3Q0ZQJYNr+F5nD23dBHh8tBC0QVNrclacTj0mxlAbWufMX/CsnfLJO6sV/bokoLVP 61gSOxYJY8mpBYCMX9G031XTIEkb8OpOqLjQSF7g= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 1D8A7352286D; Tue, 14 Apr 2020 13:56:44 -0700 (PDT) Date: Tue, 14 Apr 2020 13:56:44 -0700 From: "Paul E. McKenney" To: Zou Wei Cc: dave@stgolabs.net, josh@joshtriplett.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH-next] locktorture: use true, false for bool variable Message-ID: <20200414205644.GS17661@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <1586779379-103799-1-git-send-email-zou_wei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1586779379-103799-1-git-send-email-zou_wei@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 13, 2020 at 08:02:59PM +0800, Zou Wei wrote: > Fixes coccicheck warning: > > kernel/locking/locktorture.c:689:6-10: WARNING: Assignment of 0/1 to bool variable > kernel/locking/locktorture.c:907:2-20: WARNING: Assignment of 0/1 to bool variable > kernel/locking/locktorture.c:938:3-20: WARNING: Assignment of 0/1 to bool variable > kernel/locking/locktorture.c:668:2-19: WARNING: Assignment of 0/1 to bool variable > kernel/locking/locktorture.c:674:2-19: WARNING: Assignment of 0/1 to bool variable > kernel/locking/locktorture.c:634:2-20: WARNING: Assignment of 0/1 to bool variable > kernel/locking/locktorture.c:640:2-20: WARNING: Assignment of 0/1 to bool variable > > Reported-by: Hulk Robot > Signed-off-by: Zou Wei Applied, thank you! 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 5efbfc6..8ff6f50 100644 > --- a/kernel/locking/locktorture.c > +++ b/kernel/locking/locktorture.c > @@ -631,13 +631,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"); > @@ -665,13 +665,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"); > @@ -686,7 +686,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; > @@ -904,7 +904,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); > @@ -935,7 +935,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.6.2 >