linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] amt: Return true/false (not 1/0) from bool function
@ 2022-07-21  2:44 Yang Li
  2022-07-21  7:26 ` Taehee Yoo
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-07-21  2:44 UTC (permalink / raw)
  To: ap420073
  Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel, Yang Li,
	Abaci Robot

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

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/net/amt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/amt.c b/drivers/net/amt.c
index febfcf2d92af..2ff53e73f10f 100644
--- a/drivers/net/amt.c
+++ b/drivers/net/amt.c
@@ -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)
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] amt: Return true/false (not 1/0) from bool function
  2022-07-21  2:44 [PATCH -next] amt: Return true/false (not 1/0) from bool function Yang Li
@ 2022-07-21  7:26 ` Taehee Yoo
  0 siblings, 0 replies; 2+ messages in thread
From: Taehee Yoo @ 2022-07-21  7:26 UTC (permalink / raw)
  To: Yang Li; +Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel, Abaci Robot

Hi Yang,
Thanks a lot for this work!

2022. 7. 21. 오전 11:44에 Yang Li 이(가) 쓴 글:
 > 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.

 > ./drivers/net/amt.c:901:9-10: WARNING: return of 0/1 in function 
'amt_queue_event' with return type bool
 >
 > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
 > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
 > ---
 >   drivers/net/amt.c | 4 ++--
 >   1 file changed, 2 insertions(+), 2 deletions(-)
 >
 > diff --git a/drivers/net/amt.c b/drivers/net/amt.c
 > index febfcf2d92af..2ff53e73f10f 100644
 > --- a/drivers/net/amt.c
 > +++ b/drivers/net/amt.c
 > @@ -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)

Thanks a lot!
Taehee Yoo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-21  7:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21  2:44 [PATCH -next] amt: Return true/false (not 1/0) from bool function Yang Li
2022-07-21  7:26 ` Taehee Yoo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).