staging: rtl8723bs: remove unneeded else after return in enqueue_reorder_recvframe()
PATCH 1/1 staging: rtl8723bs: remove unneeded else after return in enqueue_reorder_recvframe()
In enqueue_reorder_recvframe(), checkpatch warns that 'else is not generally useful after a break or return'. The duplicate packet check returns false, making the following else on break redundant.
Simplify the loop control flow by using continue when advancing the list and eliminating the unneeded else statement.
--- drivers/staging/rtl8723bs/core/rtw_recv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/rtl8723bs/core/rtw_recv.c +7 -6
@@ -1782,14 +1782,15 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un pnextrframe = (union recv_frame *)plist; pnextattrib = &pnextrframe->u.hdr.attrib; -if (SN_LESS (pnextattrib->seq_num, pattrib->seq_num)) +if (SN_LESS (pnextattrib->seq_num, pattrib->seq_num)) { plist =get_next (plist); -else if (SN_EQUAL (pnextattrib->seq_num, pattrib->seq_num)) -/* Duplicate entry is found!! Do not insert current entry. */ -/* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */ +continue ; + } + +if (SN_EQUAL (pnextattrib->seq_num, pattrib->seq_num))return false; -else -break ; + +break ; }/* spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); */
base-commit: df2908090cda368b01ff43709f51890076c56157
prerequisite-patch-id: c05d9c90e8d4b20dfed666f3512e0d5bc54e2f2c
Signature · 1 line
2.55.0
Quoted 26 lines · Gabriel Windlin
In
enqueue_reorder_recvframe(), checkpatch warns that 'else is not generally useful after a break or return'. The duplicate packet check returns false, making the following else on break redundant.Simplify the loop control flow by using continue when advancing the list and eliminating the unneeded else statement.
Signed-off-by Gabriel Windlin <[email protected]>--- drivers/staging/rtl8723bs/core/rtw_recv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/staging/rtl8723bs/core/rtw_recv.c +1
-4@@ -1782,14 +1782,15 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un pnextrframe = (union recv_frame *)plist; pnextattrib = &pnextrframe->u.hdr.attrib; -if (SN_LESS (pnextattrib->seq_num, pattrib->seq_num)) +if (SN_LESS (pnextattrib->seq_num, pattrib->seq_num)) { plist =get_next (plist); -else if (SN_EQUAL (pnextattrib->seq_num, pattrib->seq_num)) -/* Duplicate entry is found!! Do not insert current entry. */ -/* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */
drivers/staging/rtl8723bs/core/rtw_recv.c static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un · line 1794
Quoted 10 lines
drivers/staging/rtl8723bs/core/rtw_recv.c +6
-2+continue ; + } + +if (SN_EQUAL (pnextattrib->seq_num, pattrib->seq_num))return false; - else - break; + +break ; }
Hi,
there is already a similar patch in the lore:
https://lore.kernel.org/linux-staging/[email protected]/T/