[PATCH] staging: rtl8723bs: remove unnecessary else after break

Vo Thanh Cong posted 1 patch 3 weeks, 5 days ago
There is a newer version of this series
.../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 30 +++++++++----------
1 file changed, 14 insertions(+), 16 deletions(-)
[PATCH] staging: rtl8723bs: remove unnecessary else after break
Posted by Vo Thanh Cong 3 weeks, 5 days ago
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
Re: [PATCH] staging: rtl8723bs: remove unnecessary else after break
Posted by Greg KH 3 weeks, 5 days ago
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