[PATCH] staging: rtl8723bs: remove redundant else after return

Tomasz Unger posted 1 patch 1 week, 4 days ago
drivers/staging/rtl8723bs/core/rtw_recv.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] staging: rtl8723bs: remove redundant else after return
Posted by Tomasz Unger 1 week, 4 days ago
In enqueue_reorder_recvframe(), the else branch after a return
statement is unnecessary. When a duplicate sequence number is found,
the function returns false immediately, making the else keyword
redundant. Remove else and fix the indentation of the break statement.

Reported by checkpatch.pl with no remaining warnings.

Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
---
 drivers/staging/rtl8723bs/core/rtw_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 86c5e2c4e7dd..51536f155750 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1789,8 +1789,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un
 			/* Duplicate entry is found!! Do not insert current entry. */
 			/* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */
 			return false;
-		else
-			break;
+		break;
 	}
 
 	/* spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); */

---
base-commit: 7cb1c5b32a2bfde961fff8d5204526b609bcb30a
change-id: 20260528-fix-else-after-return-1225fa7dec5f

Best regards,
--  
Tomasz Unger <tomasz.unger@yahoo.pl>
Re: [PATCH] staging: rtl8723bs: remove redundant else after return
Posted by Dan Carpenter 1 week, 4 days ago
On Thu, May 28, 2026 at 11:55:42AM +0200, Tomasz Unger wrote:
> In enqueue_reorder_recvframe(), the else branch after a return
> statement is unnecessary. When a duplicate sequence number is found,
> the function returns false immediately, making the else keyword
> redundant. Remove else and fix the indentation of the break statement.
> 
> Reported by checkpatch.pl with no remaining warnings.
> 
> Signed-off-by: Tomasz Unger <tomasz.unger@yahoo.pl>
> ---
>  drivers/staging/rtl8723bs/core/rtw_recv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
> index 86c5e2c4e7dd..51536f155750 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_recv.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
> @@ -1789,8 +1789,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un
>  			/* Duplicate entry is found!! Do not insert current entry. */
>  			/* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */
>  			return false;
> -		else
> -			break;
> +		break;

You have made the code buggy.  Don't follow checkpatch blindly.

regards,
dan carpenter