* [PATCH] staging: rtl8723bs: remove unneeded else after return in enqueue_reorder_recvframe()
@ 2026-09-06 23:35 Gabriel Windlin
2026-09-07 7:31 ` Nikolay Kulikov
0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Windlin @ 2026-09-06 23:35 UTC (permalink / raw)
To: Greg Kroah-Hartman, Nikolay Kulikov, Andrei Khomenkov,
Khasar Munkh-Erdene, linux-staging, linux-kernel
Cc: 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 <gawindlin@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_recv.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 7568fc514d7c..498c7273f273 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))
+ 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
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] staging: rtl8723bs: remove unneeded else after return in enqueue_reorder_recvframe()
2026-09-06 23:35 [PATCH] staging: rtl8723bs: remove unneeded else after return in enqueue_reorder_recvframe() Gabriel Windlin
@ 2026-09-07 7:31 ` Nikolay Kulikov
0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Kulikov @ 2026-09-07 7:31 UTC (permalink / raw)
To: Gabriel Windlin
Cc: Greg Kroah-Hartman, Andrei Khomenkov, Khasar Munkh-Erdene,
linux-staging, linux-kernel
On Mon, Sep 07, 2026 at 01:35:43AM +0200, Gabriel Windlin wrote:
> 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 <gawindlin@gmail.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_recv.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
> index 7568fc514d7c..498c7273f273 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))
> + 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;
> }
Hi,
there is already a similar patch in the lore:
https://lore.kernel.org/linux-staging/20260820162601.74952-1-myeonghyeon.park@gmail.com/T/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-07 7:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 23:35 [PATCH] staging: rtl8723bs: remove unneeded else after return in enqueue_reorder_recvframe() Gabriel Windlin
2026-09-07 7:31 ` Nikolay Kulikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®