Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] rtl8xxxu: remove unnecessary labels
@ 2021-07-20  7:00 samirweng1979
  2021-07-21 13:37 ` Jes Sorensen
  0 siblings, 1 reply; 2+ messages in thread
From: samirweng1979 @ 2021-07-20  7:00 UTC (permalink / raw)
  To: Jes.Sorensen, kvalo, davem, kuba
  Cc: linux-wireless, netdev, linux-kernel, wengjianfeng

From: wengjianfeng <wengjianfeng@yulong.com>

Simplify the code by removing unnecessary labels and returning directly.

Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
index 4f93f88..3fd14e6 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
@@ -256,10 +256,8 @@ static int rtl8723a_emu_to_active(struct rtl8xxxu_priv *priv)
 		udelay(10);
 	}
 
-	if (!count) {
-		ret = -EBUSY;
-		goto exit;
-	}
+	if (!count)
+		return -EBUSY;
 
 	/* We should be able to optimize the following three entries into one */
 
@@ -292,10 +290,8 @@ static int rtl8723a_emu_to_active(struct rtl8xxxu_priv *priv)
 		udelay(10);
 	}
 
-	if (!count) {
-		ret = -EBUSY;
-		goto exit;
-	}
+	if (!count)
+		return -EBUSY;
 
 	/* 0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */
 	/*
@@ -307,7 +303,6 @@ static int rtl8723a_emu_to_active(struct rtl8xxxu_priv *priv)
 	val8 &= ~LEDCFG2_DPDT_SELECT;
 	rtl8xxxu_write8(priv, REG_LEDCFG2, val8);
 
-exit:
 	return ret;
 }
 
@@ -327,7 +322,7 @@ static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
 
 	ret = rtl8723a_emu_to_active(priv);
 	if (ret)
-		goto exit;
+		return ret;
 
 	/*
 	 * 0x0004[19] = 1, reset 8051
@@ -353,7 +348,7 @@ static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
 	val32 &= ~(BIT(28) | BIT(29) | BIT(30));
 	val32 |= (0x06 << 28);
 	rtl8xxxu_write32(priv, REG_EFUSE_CTRL, val32);
-exit:
+
 	return ret;
 }
 
-- 
1.9.1


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

* Re: [PATCH] rtl8xxxu: remove unnecessary labels
  2021-07-20  7:00 [PATCH] rtl8xxxu: remove unnecessary labels samirweng1979
@ 2021-07-21 13:37 ` Jes Sorensen
  0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2021-07-21 13:37 UTC (permalink / raw)
  To: samirweng1979, kvalo, davem, kuba
  Cc: linux-wireless, netdev, linux-kernel, wengjianfeng

On 7/20/21 3:00 AM, samirweng1979 wrote:
> From: wengjianfeng <wengjianfeng@yulong.com>
> 
> Simplify the code by removing unnecessary labels and returning directly.
> 
> Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
> ---
>  drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)

NACK

Using gotos to have a unified exit path keeps the code cleaner and makes
it easier to ensure locking is correct where applicable.

Jes

> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> index 4f93f88..3fd14e6 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c
> @@ -256,10 +256,8 @@ static int rtl8723a_emu_to_active(struct rtl8xxxu_priv *priv)
>  		udelay(10);
>  	}
>  
> -	if (!count) {
> -		ret = -EBUSY;
> -		goto exit;
> -	}
> +	if (!count)
> +		return -EBUSY;
>  
>  	/* We should be able to optimize the following three entries into one */
>  
> @@ -292,10 +290,8 @@ static int rtl8723a_emu_to_active(struct rtl8xxxu_priv *priv)
>  		udelay(10);
>  	}
>  
> -	if (!count) {
> -		ret = -EBUSY;
> -		goto exit;
> -	}
> +	if (!count)
> +		return3RGD9F -EBUSY;
>  
>  	/* 0x4C[23] = 0x4E[7] = 1, switch DPDT_SEL_P output from WL BB */
>  	/*
> @@ -307,7 +303,6 @@ static int rtl8723a_emu_to_active(struct rtl8xxxu_priv *priv)
>  	val8 &= ~LEDCFG2_DPDT_SELECT;
>  	rtl8xxxu_write8(priv, REG_LEDCFG2, val8);
>  
> -exit:
>  	return ret;
>  }
>  
> @@ -327,7 +322,7 @@ static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
>  
>  	ret = rtl8723a_emu_to_active(priv);
>  	if (ret)
> -		goto exit;
> +		return ret;
>  
>  	/*
>  	 * 0x0004[19] = 1, reset 8051
> @@ -353,7 +348,7 @@ static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
>  	val32 &= ~(BIT(28) | BIT(29) | BIT(30));
>  	val32 |= (0x06 << 28);
>  	rtl8xxxu_write32(priv, REG_EFUSE_CTRL, val32);
> -exit:
> +
>  	return ret;
>  }
>  
> 


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

end of thread, other threads:[~2021-07-21 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20  7:00 [PATCH] rtl8xxxu: remove unnecessary labels samirweng1979
2021-07-21 13:37 ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).