All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: core: remove local variable and goto statement
@ 2021-10-26  4:24 Saurav Girepunje
  2021-10-26  4:30 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Saurav Girepunje @ 2021-10-26  4:24 UTC (permalink / raw)
  To: gregkh, fabioaiuto83, ross.schm.dev, marcocesati,
	matthew.v.deangelis, linux-staging, linux-kernel
  Cc: saurav.girepunje

In the function rtw_validate_bssid() remove the goto statement.
As on goto exit label, function is returning without any cleanup.
In this function goto statement can be replace by simple return
statement, which will improve readability. After replacing
the goto statement local variable ret is also not needed. So
remove the ret local variable.

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_ioctl_set.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
index 8c11daff2d59..11e9421cad58 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
@@ -24,15 +24,10 @@ u8 rtw_validate_bssid(u8 *bssid)

 u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
 {
-	u8 ret = true;
-
-	if (ssid->ssid_length > 32) {
-		ret = false;
-		goto exit;
-	}
+	if (ssid->ssid_length > 32)
+		return false;

-exit:
-	return ret;
+	return true;
 }

 u8 rtw_do_join(struct adapter *padapter)
--
2.33.0


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

* Re: [PATCH] staging: rtl8723bs: core: remove local variable and goto statement
  2021-10-26  4:24 [PATCH] staging: rtl8723bs: core: remove local variable and goto statement Saurav Girepunje
@ 2021-10-26  4:30 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2021-10-26  4:30 UTC (permalink / raw)
  To: Saurav Girepunje, gregkh, fabioaiuto83, ross.schm.dev,
	marcocesati, matthew.v.deangelis, linux-staging, linux-kernel
  Cc: saurav.girepunje

On Tue, 2021-10-26 at 09:54 +0530, Saurav Girepunje wrote:
> In the function rtw_validate_bssid() remove the goto statement.
> As on goto exit label, function is returning without any cleanup.
> In this function goto statement can be replace by simple return
> statement, which will improve readability. After replacing
> the goto statement local variable ret is also not needed. So
> remove the ret local variable.
[]
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c b/drivers/staging/rtl8723bs/core/rtw_ioctl_set.c
[]
> @@ -24,15 +24,10 @@ u8 rtw_validate_bssid(u8 *bssid)
> 
>  u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
>  {
> -	u8 ret = true;
> -
> -	if (ssid->ssid_length > 32) {
> -		ret = false;
> -		goto exit;
> -	}
> +	if (ssid->ssid_length > 32)
> +		return false;
> 
> -exit:
> -	return ret;
> +	return true;
>  }

bool rtw_validate_ssid(const struct ndis_802_11_ssid *ssid)
{
	return ssid->ssid_length <= 32;
}



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

end of thread, other threads:[~2021-10-26  4:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26  4:24 [PATCH] staging: rtl8723bs: core: remove local variable and goto statement Saurav Girepunje
2021-10-26  4:30 ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.