diff mbox series

NFC:Fix Warning: Comparison to bool

Message ID 1606374942-1570157-1-git-send-email-xia1@linux.alibaba.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series NFC:Fix Warning: Comparison to bool | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Runzhe Wang Nov. 26, 2020, 7:15 a.m. UTC
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(-)

Comments

Jakub Kicinski Nov. 27, 2020, 10:59 p.m. UTC | #1
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);
diff mbox series

Patch

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);