All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: reorder conditions to avoid else branch
@ 2026-08-20 16:26 myeonghyeon.park
  2026-08-20 17:10 ` Greg Kroah-Hartman
  2026-08-20 18:53 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: myeonghyeon.park @ 2026-08-20 16:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel

Fix the checkpatch.pl warning:

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

in core/rtw_recv.c.

Return early when the SN_EQUAL() condition is met and break when
SN_LESS() condition is false to eliminate the unnecessary else branch.

Signed-off-by: myeonghyeon.park <myeonghyeon.park@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 7568fc514d7c..5776d0212ab8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -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))
-			plist = get_next(plist);
-		else if (SN_EQUAL(pnextattrib->seq_num, pattrib->seq_num))
+		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); */
 			return false;
-		else
+
+		if (!SN_LESS(pnextattrib->seq_num, pattrib->seq_num))
 			break;
+
+		plist = get_next(plist);
 	}
 
 	/* spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); */
-- 
2.52.0


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

end of thread, other threads:[~2026-08-20 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20 16:26 [PATCH] staging: rtl8723bs: reorder conditions to avoid else branch myeonghyeon.park
2026-08-20 17:10 ` Greg Kroah-Hartman
2026-08-20 18:53 ` Dan Carpenter

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.