mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove unnecessary else after break
@ 2026-01-11 18:06 Vo Thanh Cong
  2026-01-12 10:59 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Vo Thanh Cong @ 2026-01-11 18:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, anac.amplar, Vo Thanh Cong

This patch fixes the checkpatch.pl warning:
"WARNING: else is not generally useful after a break or return"

In sdio_ops_linux.c, the else blocks after break statements are
redundant. Removing them reduces indentation level and improves
code readability.

Signed-off-by: Vo Thanh Cong <thanhcongvo079@gmail.com>
---
 .../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 30 +++++++++----------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
index 5dc00e9117ae..87444d36c502 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
@@ -219,14 +219,14 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
 			if (*err == 0) {
 				rtw_reset_continual_io_error(psdiodev);
 				break;
-			} else {
-				if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
-					padapter->bSurpriseRemoved = true;
-
-				if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
-					padapter->bSurpriseRemoved = true;
-					break;
-				}
+			}
+
+			if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
+				padapter->bSurpriseRemoved = true;
+
+			if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
+				padapter->bSurpriseRemoved = true;
+				break;
 			}
 		}
 	}
@@ -295,14 +295,12 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)
 			if (*err == 0) {
 				rtw_reset_continual_io_error(psdiodev);
 				break;
-			} else {
-				if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
-					padapter->bSurpriseRemoved = true;
-
-				if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
-					padapter->bSurpriseRemoved = true;
-					break;
-				}
+			}
+			if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
+				padapter->bSurpriseRemoved = true;
+			if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
+				padapter->bSurpriseRemoved = true;
+				break;
 			}
 		}
 	}
-- 
2.52.0


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

* Re: [PATCH] staging: rtl8723bs: remove unnecessary else after break
  2026-01-11 18:06 [PATCH] staging: rtl8723bs: remove unnecessary else after break Vo Thanh Cong
@ 2026-01-12 10:59 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-01-12 10:59 UTC (permalink / raw)
  To: Vo Thanh Cong; +Cc: linux-staging, linux-kernel, anac.amplar

On Mon, Jan 12, 2026 at 01:06:35AM +0700, Vo Thanh Cong wrote:
> This patch fixes the checkpatch.pl warning:
> "WARNING: else is not generally useful after a break or return"
> 
> In sdio_ops_linux.c, the else blocks after break statements are
> redundant. Removing them reduces indentation level and improves
> code readability.
> 
> Signed-off-by: Vo Thanh Cong <thanhcongvo079@gmail.com>
> ---
>  .../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 30 +++++++++----------
>  1 file changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
> index 5dc00e9117ae..87444d36c502 100644
> --- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
> @@ -219,14 +219,14 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
>  			if (*err == 0) {
>  				rtw_reset_continual_io_error(psdiodev);
>  				break;
> -			} else {
> -				if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
> -					padapter->bSurpriseRemoved = true;
> -
> -				if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
> -					padapter->bSurpriseRemoved = true;
> -					break;
> -				}
> +			}
> +
> +			if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
> +				padapter->bSurpriseRemoved = true;
> +
> +			if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
> +				padapter->bSurpriseRemoved = true;
> +				break;
>  			}
>  		}
>  	}
> @@ -295,14 +295,12 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)
>  			if (*err == 0) {
>  				rtw_reset_continual_io_error(psdiodev);
>  				break;
> -			} else {
> -				if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
> -					padapter->bSurpriseRemoved = true;
> -
> -				if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
> -					padapter->bSurpriseRemoved = true;
> -					break;
> -				}
> +			}
> +			if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
> +				padapter->bSurpriseRemoved = true;
> +			if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
> +				padapter->bSurpriseRemoved = true;
> +				break;

You dropped the blank line before this if statement, why?

Please preserve line breaks like this, it makes the code easier to read
and understand.

thanks,

greg k-h

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

* [PATCH] staging: rtl8723bs: remove unnecessary else after break
@ 2026-08-09 16:15 Raushan Kumar
  0 siblings, 0 replies; 3+ messages in thread
From: Raushan Kumar @ 2026-08-09 16:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Raushan Kumar

Remove else following a break statement in
enqueue_reorder_recvframe(), since the preceding if branch
already returns, making the else redundant, as flagged by
checkpatch.pl.

Signed-off-by: Raushan Kumar <mitramaurya80@gmail.com>
---
 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); */
-- 
2.55.0


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

end of thread, other threads:[~2026-08-09 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-11 18:06 [PATCH] staging: rtl8723bs: remove unnecessary else after break Vo Thanh Cong
2026-01-12 10:59 ` Greg KH
2026-08-09 16:15 Raushan Kumar

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®