Skip to contentSkip to conversation

cpumask: use false and true for bool variables

PATCH In review Zou Wei 3 participants 3 messages Nov 9, 2020

Subsystems (2)
lore
Share & tools
lore

Zou Wei

author
#0 lore raw

PATCH 1/1 cpumask: use false and true for bool variables

Fix coccicheck warnings:

./lib/cpumask.c:342:6-13: WARNING: Comparison of 0/1 to bool variable ./lib/cpumask.c:351:33-40: WARNING: Comparison of 0/1 to bool variable ./lib/cpumask.c:406:3-11: WARNING: Assignment of 0/1 to bool variable

---
 lib/cpumask.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
lib/cpumask.c +3 -3
index 34ecb30..74d0cf1 100644
@@ -339,7 +339,7 @@ static int find_nearest_node(int *node_dist, bool *used)
 
 	/* Choose the first unused node to compare */
 	for (i = 0; i < nr_node_ids; i++) {
-		if (used[i] == 0) {
+		if (used[i] == false) {
 			min_dist = node_dist[i];
 			node_id = i;
 			break;
@@ -348,7 +348,7 @@ static int find_nearest_node(int *node_dist, bool *used)
 
 	/* Compare and return the nearest node */
 	for (i = 0; i < nr_node_ids; i++) {
-		if (node_dist[i] < min_dist && used[i] == 0) {
+		if (node_dist[i] < min_dist && used[i] == false) {
 			min_dist = node_dist[i];
 			node_id = i;
 		}
@@ -403,7 +403,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
 							       flags);
 					return cpu;
 				}
-			used[id] = 1;
+			used[id] = true;
 		}
 		spin_unlock_irqrestore(&spread_lock, flags);
 
Signature · 1 line
2.6.2
#1 lore raw
Quoted 5 lines · Zou Wei

Fix coccicheck warnings:

./lib/cpumask.c:342:6-13: WARNING: Comparison of 0/1 to bool variable ./lib/cpumask.c:351:33-40: WARNING: Comparison of 0/1 to bool variable ./lib/cpumask.c:406:3-11: WARNING: Assignment of 0/1 to bool variable

None of that is a problem, please, apply:

https://lkml.kernel.org/r/[email protected]

and go do something useful.

#2 lore raw
In reply to Zou Wei
Quoted 7 lines · Zou Wei

Fix coccicheck warnings:

./lib/cpumask.c:342:6-13: WARNING: Comparison of 0/1 to bool variable ./lib/cpumask.c:351:33-40: WARNING: Comparison of 0/1 to bool variable ./lib/cpumask.c:406:3-11: WARNING: Assignment of 0/1 to bool variable

It seems "Hulk Robot" needs an AI "tune-up". I didn't touch any of these lines of code - and I'm guessing they haven't changed in years.

Paul.
--

Quoted 37 lines
---
  lib/cpumask.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
lib/cpumask.c +3 -3
index 34ecb30..74d0cf1 100644
@@ -339,7 +339,7 @@ static int find_nearest_node(int *node_dist, bool *used)
 
  	/* Choose the first unused node to compare */
  	for (i = 0; i < nr_node_ids; i++) {
-		if (used[i] == 0) {
+		if (used[i] == false) {
  			min_dist = node_dist[i];
  			node_id = i;
  			break;
@@ -348,7 +348,7 @@ static int find_nearest_node(int *node_dist, bool *used)
 
  	/* Compare and return the nearest node */
  	for (i = 0; i < nr_node_ids; i++) {
-		if (node_dist[i] < min_dist && used[i] == 0) {
+		if (node_dist[i] < min_dist && used[i] == false) {
  			min_dist = node_dist[i];
  			node_id = i;
  		}
@@ -403,7 +403,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
  							       flags);
  					return cpu;
  				}
-			used[id] = 1;
+			used[id] = true;
  		}
  		spin_unlock_irqrestore(&spread_lock, flags);