Skip to contentSkip to conversation

amt: Return true/false (not 1/0) from bool function

PATCH In review Yang Li 2 participants 2 messages Jul 21, 2022

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 amt: Return true/false (not 1/0) from bool function

Return boolean values ("true" or "false") instead of 1 or 0 from bool functions. This fixes the following warnings from coccicheck:

./drivers/net/amt.c:901:9-10: WARNING: return of 0/1 in function 'amt_queue_event' with return type bool

---
 drivers/net/amt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/amt.c +2 -2
index febfcf2d92af..2ff53e73f10f 100644
@@ -898,7 +898,7 @@ static bool amt_queue_event(struct amt_dev *amt, enum amt_event event,
 	spin_lock_bh(&amt->lock);
 	if (amt->nr_events >= AMT_MAX_EVENTS) {
 		spin_unlock_bh(&amt->lock);
-		return 1;
+		return true;
 	}
 
 	index = (amt->event_idx + amt->nr_events) % AMT_MAX_EVENTS;
@@ -909,7 +909,7 @@ static bool amt_queue_event(struct amt_dev *amt, enum amt_event event,
 	queue_work(amt_wq, &amt->event_wq);
 	spin_unlock_bh(&amt->lock);
 
-	return 0;
+	return false;
 }
 
 static void amt_secret_work(struct work_struct *work)
Signature · 1 line
2.20.1.7.g153144c
maintainer
#1 lore raw

Hi Yang,
Thanks a lot for this work!

2022. 7. 21. 오전 11:44에 Yang Li 이(가) 쓴 글:

Quoted 3 lines

Return boolean values ("true" or "false") instead of 1 or 0 from bool functions. This fixes the following warnings from coccicheck:

commit 30e22a6ebca0 ("amt: use workqueue for gateway side message handling") is not yet merged into net-next branch. So, this patch can't be applied to net-next right now.

Quoted 22 lines

./drivers/net/amt.c:901:9-10: WARNING: return of 0/1 in function 'amt_queue_event' with return type bool

---
  drivers/net/amt.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/amt.c +1 -1
index febfcf2d92af..2ff53e73f10f 100644
@@ -898,7 +898,7 @@ static bool amt_queue_event(struct amt_dev *amt, enum amt_event event,
  	spin_lock_bh(&amt->lock);
  	if (amt->nr_events >= AMT_MAX_EVENTS) {
  		spin_unlock_bh(&amt->lock);
-		return 1;
+		return true;
  	}
 
  	index = (amt->event_idx + amt->nr_events) % AMT_MAX_EVENTS;

drivers/net/amt.c static bool amt_queue_event(struct amt_dev *amt, enum amt_event event, · line 915

Quoted 8 lines
drivers/net/amt.c +1 -1
@@ -909,7 +909,7 @@ static bool amt_queue_event(struct amt_dev *amt, enum amt_event event,
  	queue_work(amt_wq, &amt->event_wq);
  	spin_unlock_bh(&amt->lock);
 
-	return 0;
+	return false;
  }
 
  static void amt_secret_work(struct work_struct *work)

Thanks a lot!
Taehee Yoo