All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFC:Fix Warning: Comparison to bool
@ 2020-11-26  7:15 Runzhe Wang
  2020-11-27 22:59 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Runzhe Wang @ 2020-11-26  7:15 UTC (permalink / raw)
  To: davem; +Cc: kuba, netdev, linux-kernel, Runzhe Wang

This patch uses the shdlc->rnr variable as a judgment condition of
statement, rather than compares with bool.

Signed-off-by: Runzhe Wang <xia1@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
---
 net/nfc/hci/llc_shdlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c
index 0eb4ddc..f178a42 100644
--- a/net/nfc/hci/llc_shdlc.c
+++ b/net/nfc/hci/llc_shdlc.c
@@ -319,7 +319,7 @@ static void llc_shdlc_rcv_s_frame(struct llc_shdlc *shdlc,
 	switch (s_frame_type) {
 	case S_FRAME_RR:
 		llc_shdlc_rcv_ack(shdlc, nr);
-		if (shdlc->rnr == true) {	/* see SHDLC 10.7.7 */
+		if (shdlc->rnr) {	/* see SHDLC 10.7.7 */
 			shdlc->rnr = false;
 			if (shdlc->send_q.qlen == 0) {
 				skb = llc_shdlc_alloc_skb(shdlc, 0);
-- 
1.8.3.1


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

* Re: [PATCH] NFC:Fix Warning: Comparison to bool
  2020-11-26  7:15 [PATCH] NFC:Fix Warning: Comparison to bool Runzhe Wang
@ 2020-11-27 22:59 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-11-27 22:59 UTC (permalink / raw)
  To: Runzhe Wang; +Cc: davem, netdev, linux-kernel

On Thu, 26 Nov 2020 15:15:42 +0800 Runzhe Wang wrote:
> This patch uses the shdlc->rnr variable as a judgment condition of
> statement, rather than compares with bool.
> 
> Signed-off-by: Runzhe Wang <xia1@linux.alibaba.com>
> Reported-by: Abaci <abaci@linux.alibaba.com>

"Fix Warning" sounds like you're addressing a real compiler warning,
please use a more suitable subject if the warning in question is from
your own tool. Like "nfc: refactor unnecessary comparison to bool".

> diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c
> index 0eb4ddc..f178a42 100644
> --- a/net/nfc/hci/llc_shdlc.c
> +++ b/net/nfc/hci/llc_shdlc.c
> @@ -319,7 +319,7 @@ static void llc_shdlc_rcv_s_frame(struct llc_shdlc *shdlc,
>  	switch (s_frame_type) {
>  	case S_FRAME_RR:
>  		llc_shdlc_rcv_ack(shdlc, nr);
> -		if (shdlc->rnr == true) {	/* see SHDLC 10.7.7 */
> +		if (shdlc->rnr) {	/* see SHDLC 10.7.7 */

rnr is a bool, this is perfectly legal, there are also comparisons to
false which you don't fix, and nobody has touched this driver in 8
years so polishing this code is not exactly worth the effort.

I'm not applying this patch, sorry.

>  			shdlc->rnr = false;
>  			if (shdlc->send_q.qlen == 0) {
>  				skb = llc_shdlc_alloc_skb(shdlc, 0);


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

end of thread, other threads:[~2020-11-27 23:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  7:15 [PATCH] NFC:Fix Warning: Comparison to bool Runzhe Wang
2020-11-27 22:59 ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.