Skip to contentSkip to conversation

Staging: rtl8188eu: core: else is not generally useful after a break or return

PATCH In review Hatice ERTÜRK 3 participants 4 messages Feb 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8188eu: core: else is not generally useful after a break or return

Fixes checkpatch warnings:

WARNING: else is not generally useful after a break or return

---
 drivers/staging/rtl8188eu/core/rtw_recv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_recv.c +2 -2
index bd79e9e..2b022be 100644
@@ -1779,8 +1779,8 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
 			plist = plist->next;
 		else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num))
 			return false;
-		else
-			break;
+
+		break;
 	}
 
 	list_del_init(&(prframe->list));
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · On Saturday 21 February 2015 20:16:52 Hatice ERTÜRK wrote:
drivers/staging/rtl8188eu/core/rtw_recv.c +0 -0
index bd79e9e..2b022be 100644

drivers/staging/rtl8188eu/core/rtw_recv.c static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, · line 1785

Quoted 9 lines
drivers/staging/rtl8188eu/core/rtw_recv.c +2 -2
@@ -1779,8 +1779,8 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
                        plist = plist->next;
                else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num))
                        return false;
-               else
-                       break;
+
+               break;
        }
 

This is not a correct change, you add a 'break' in the case that the first condition was true, which did not exist earlier.

Arnd

#2 lore raw

ok.I'have changed. But it says "else is not generally useful after a break or return"

21 Şubat 2015 Cumartesi 23:34:34 UTC+2 tarihinde Arnd Bergmann yazdı:

Quoted 25 lines · On Saturday 21 February 2015 20:16:52 Hatice ERTÜRK wrote:

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/staging/rtl8188eu/core/rtw_recv.c

drivers/staging/rtl8188eu/core/rtw_recv.c static int enqueue_reorder_recvframe(struct

Quoted 4 lines

index bd79e9e..2b022be 100644

drivers/staging/rtl8188eu/core/rtw_recv.c +0 -0
@@ -1779,8 +1779,8 @@ static int enqueue_reorder_recvframe(struct 

recv_reorder_ctrl *preorder_ctrl,

drivers/staging/rtl8188eu/core/rtw_recv.c static int enqueue_reorder_recvframe(struct · line 1780

Quoted 2 lines
drivers/staging/rtl8188eu/core/rtw_recv.c +0 -0
                        plist = plist->next; 
                else if (SN_EQUAL(pnextattrib->seq_num, 

pattrib->seq_num))

drivers/staging/rtl8188eu/core/rtw_recv.c static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, · line 1785

Quoted 7 lines
drivers/staging/rtl8188eu/core/rtw_recv.c +2 -2
                        return false; 
-               else 
-                       break; 
+ 
+               break; 
        } 
 

This is not a correct change, you add a 'break' in the case that the first condition was true, which did not exist earlier.

Arnd

#3 lore raw
Quoted 2 lines · Hatice ERTÜRK

ok.I'have changed. But it says "else is not generally useful after a break or return"

Checkpatch is not that clever. It may just look on the line before. In this case the structure is

if X
then Y
else
if A
then return
else C

The transformation proposed by checkpatch is only valid when every branch returns. That is, if Y were a return also.

julia

Quoted 37 lines

21 Şubat 2015 Cumartesi 23:34:34 UTC+2 tarihinde Arnd Bergmann yazdı:

      On Saturday 21 February 2015 20:16:52 Hatice ERTÜRK wrote:
      > diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c
      b/drivers/staging/rtl8188eu/core/rtw_recv.c
      > index bd79e9e..2b022be 100644
      > --- a/drivers/staging/rtl8188eu/core/rtw_recv.c
      > +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
      > @@ -1779,8 +1779,8 @@ static int
      enqueue_reorder_recvframe(struct recv_reorder_ctrl
      *preorder_ctrl,
      >                         plist = plist->next;
      >                 else if (SN_EQUAL(pnextattrib->seq_num,
      pattrib->seq_num))
      >                         return false;
      > -               else
      > -                       break;
      > +
      > +               break;
      >         }
      >  

      This is not a correct change, you add a 'break' in the case that
      the first condition was true, which did not exist earlier.

              Arnd

--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/efcf0928-ffb8-408d-bb30- ac6634d72b3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.