Skip to content

Commit d02c6b5

Browse files
SamuelZOUpaulmckrcu
authored andcommitted
locktorture: Use true and false to assign to bool variables
This commit fixes the following coccicheck warnings: 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 <[email protected]> Signed-off-by: Zou Wei <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 6582e7f commit d02c6b5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kernel/locking/locktorture.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,13 @@ static int lock_torture_writer(void *arg)
631631
cxt.cur_ops->writelock();
632632
if (WARN_ON_ONCE(lock_is_write_held))
633633
lwsp->n_lock_fail++;
634-
lock_is_write_held = 1;
634+
lock_is_write_held = true;
635635
if (WARN_ON_ONCE(lock_is_read_held))
636636
lwsp->n_lock_fail++; /* rare, but... */
637637

638638
lwsp->n_lock_acquired++;
639639
cxt.cur_ops->write_delay(&rand);
640-
lock_is_write_held = 0;
640+
lock_is_write_held = false;
641641
cxt.cur_ops->writeunlock();
642642

643643
stutter_wait("lock_torture_writer");
@@ -665,13 +665,13 @@ static int lock_torture_reader(void *arg)
665665
schedule_timeout_uninterruptible(1);
666666

667667
cxt.cur_ops->readlock();
668-
lock_is_read_held = 1;
668+
lock_is_read_held = true;
669669
if (WARN_ON_ONCE(lock_is_write_held))
670670
lrsp->n_lock_fail++; /* rare, but... */
671671

672672
lrsp->n_lock_acquired++;
673673
cxt.cur_ops->read_delay(&rand);
674-
lock_is_read_held = 0;
674+
lock_is_read_held = false;
675675
cxt.cur_ops->readunlock();
676676

677677
stutter_wait("lock_torture_reader");
@@ -686,7 +686,7 @@ static int lock_torture_reader(void *arg)
686686
static void __torture_print_stats(char *page,
687687
struct lock_stress_stats *statp, bool write)
688688
{
689-
bool fail = 0;
689+
bool fail = false;
690690
int i, n_stress;
691691
long max = 0, min = statp ? statp[0].n_lock_acquired : 0;
692692
long long sum = 0;
@@ -904,7 +904,7 @@ static int __init lock_torture_init(void)
904904

905905
/* Initialize the statistics so that each run gets its own numbers. */
906906
if (nwriters_stress) {
907-
lock_is_write_held = 0;
907+
lock_is_write_held = false;
908908
cxt.lwsa = kmalloc_array(cxt.nrealwriters_stress,
909909
sizeof(*cxt.lwsa),
910910
GFP_KERNEL);
@@ -935,7 +935,7 @@ static int __init lock_torture_init(void)
935935
}
936936

937937
if (nreaders_stress) {
938-
lock_is_read_held = 0;
938+
lock_is_read_held = false;
939939
cxt.lrsa = kmalloc_array(cxt.nrealreaders_stress,
940940
sizeof(*cxt.lrsa),
941941
GFP_KERNEL);

0 commit comments

Comments
 (0)