Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4084039ybb; Mon, 13 Apr 2020 23:36:00 -0700 (PDT) X-Google-Smtp-Source: APiQypLy7msfwcYQ36TsayPZEkxLPRPzNLNbs2AlfZ51sW8ezxzKLfV126s1QZ6XhSo/Q0UVBnRx X-Received: by 2002:a05:6402:1657:: with SMTP id s23mr16996998edx.74.1586846160039; Mon, 13 Apr 2020 23:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586846160; cv=none; d=google.com; s=arc-20160816; b=viZunnG8lq8kNl/RLEWeUItMcm6imhyaxKxDOxvXjtRujabQMIziCTuRdLZCZ0lmK8 ZZrNv95HmTa/TFpSx3wc6583jH7ObI4KrcqA3eeCLZubpV6+iCO3R1LU8oA8pUEsYmbZ ySVzAfMotdOpR2b+H7PpigIXSgP+Y2WMJj53OVyfY6YTSDTmIe6wDhenMMTgzysHYGHC FBf8eFAsv2k5xoOp6WfT4p9obwjNFhD8qBSpQTzoeqMTJegjsgN0g0sK0X+/EqzqVLIH O0h2qk7xQftNfkr/xp8RCPVUNfPapwLmm0C3wZA319lVX6GG8oWyaOFTortRyP21/u+/ kz2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=vouZhtmmZY1Hw5riZeEwgwAoFuS19MAbJNEu5DfM19g=; b=ZGMPdn4WKCp9zSMSjUV0eFofX22vMjf6L4iA8vAHC9GF0jdAc23HUbExZO1XPWIT0j nnRVtWFahJYpQHxvYXayFII54eMadBuKd2WN3jcE06RYGevpd1FTQESOal0pJGvaa7ze vUlzfFcOm06nMmtqObPn7kHYbFsbjh5o9q/JEoM1DKrHTTdd5Ei2Fuh9jFYx+s5+IzBi 7n35M/1YvHesy9pFrGDKHs+d/8T9PNYrWF4kBdz83us42akM1J5ZDxcKqOyW31fj1NLu uMvsIVgvQ5wmo4+CukMzPyEJouiQbJrO/VKFyWPSKKJoRFEB+oev7VOIkyr/0uSgr0YI EPBw== 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 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si10030884edz.524.2020.04.13.23.35.23; Mon, 13 Apr 2020 23:36:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728917AbgDML4p (ORCPT + 99 others); Mon, 13 Apr 2020 07:56:45 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:36906 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727907AbgDML4p (ORCPT ); Mon, 13 Apr 2020 07:56:45 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 473CBDE56527D95F600F; Mon, 13 Apr 2020 19:56:43 +0800 (CST) Received: from linux-lmwb.huawei.com (10.175.103.112) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 13 Apr 2020 19:56:34 +0800 From: Zou Wei To: , , , CC: Zou Wei Subject: [PATCH-next] locktorture: use true, false for bool variable Date: Mon, 13 Apr 2020 20:02:59 +0800 Message-ID: <1586779379-103799-1-git-send-email-zou_wei@huawei.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.103.112] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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