public inbox for outreachy@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: remove unnecessary else block after return
@ 2025-03-25 14:42 Abraham Samuel Adekunle
  2025-03-25 14:48 ` Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Abraham Samuel Adekunle @ 2025-03-25 14:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Julia Lawall, outreachy; +Cc: linux-staging, linux-kernel

The else block after the return statement is unnecessary since
execution does not continue past the return statement.

Remove the else block while preserving logic making the code cleaner
and more readable.

reported by checkpatch:

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

Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 5ded183aa08c..91c6a962f7e8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2022,12 +2022,12 @@ signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, u
 	}

 	iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
-	if (iEntry < 0) {
+	if (iEntry < 0)
 		return ielength;
-	} else {
-		if (authmode == WLAN_EID_RSN)
-			ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
-	}
+
+	if (authmode == WLAN_EID_RSN)
+		ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
+
 	return ielength;
 }

--
2.34.1


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

* Re: [PATCH] staging: rtl8723bs: remove unnecessary else block after return
  2025-03-25 14:42 [PATCH] staging: rtl8723bs: remove unnecessary else block after return Abraham Samuel Adekunle
@ 2025-03-25 14:48 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2025-03-25 14:48 UTC (permalink / raw)
  To: Abraham Samuel Adekunle
  Cc: Greg Kroah-Hartman, outreachy, linux-staging, linux-kernel



On Tue, 25 Mar 2025, Abraham Samuel Adekunle wrote:

> The else block after the return statement is unnecessary since
> execution does not continue past the return statement.
>
> Remove the else block while preserving logic making the code cleaner
> and more readable.
>
> reported by checkpatch:
>
> WARNING: else is not generally useful after a break or return
>
> Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com>

Reviewed-by: Julia Lawall <julia.lawall@inria.fr>,

> ---
>  drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> index 5ded183aa08c..91c6a962f7e8 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
> @@ -2022,12 +2022,12 @@ signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, u
>  	}
>
>  	iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
> -	if (iEntry < 0) {
> +	if (iEntry < 0)
>  		return ielength;
> -	} else {
> -		if (authmode == WLAN_EID_RSN)
> -			ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
> -	}
> +
> +	if (authmode == WLAN_EID_RSN)
> +		ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
> +
>  	return ielength;
>  }
>
> --
> 2.34.1
>
>

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

end of thread, other threads:[~2025-03-25 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 14:42 [PATCH] staging: rtl8723bs: remove unnecessary else block after return Abraham Samuel Adekunle
2025-03-25 14:48 ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox