netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: lan743x: Remove extranous gotos
@ 2023-06-02  0:04 Moritz Fischer
  2023-06-02  8:54 ` Siddharth Vadapalli
  2023-06-02  9:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Moritz Fischer @ 2023-06-02  0:04 UTC (permalink / raw)
  To: netdev
  Cc: pabeni, kuba, edumazet, davem, bryan.whitehead, UNGLinuxDriver,
	Moritz Fischer

The gotos for cleanup aren't required, the function
might as well just return the actual error code.

Signed-off-by: Moritz Fischer <moritzf@google.com>
---
 drivers/net/ethernet/microchip/lan743x_main.c | 20 +++++--------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 957d96a91a8a..f1bded993edc 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -160,16 +160,13 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
 {
 	struct lan743x_csr *csr = &adapter->csr;
 	resource_size_t bar_start, bar_length;
-	int result;
 
 	bar_start = pci_resource_start(adapter->pdev, 0);
 	bar_length = pci_resource_len(adapter->pdev, 0);
 	csr->csr_address = devm_ioremap(&adapter->pdev->dev,
 					bar_start, bar_length);
-	if (!csr->csr_address) {
-		result = -ENOMEM;
-		goto clean_up;
-	}
+	if (!csr->csr_address)
+		return -ENOMEM;
 
 	csr->id_rev = lan743x_csr_read(adapter, ID_REV);
 	csr->fpga_rev = lan743x_csr_read(adapter, FPGA_REV);
@@ -177,10 +174,8 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
 		   "ID_REV = 0x%08X, FPGA_REV = %d.%d\n",
 		   csr->id_rev,	FPGA_REV_GET_MAJOR_(csr->fpga_rev),
 		   FPGA_REV_GET_MINOR_(csr->fpga_rev));
-	if (!ID_REV_IS_VALID_CHIP_ID_(csr->id_rev)) {
-		result = -ENODEV;
-		goto clean_up;
-	}
+	if (!ID_REV_IS_VALID_CHIP_ID_(csr->id_rev))
+		return -ENODEV;
 
 	csr->flags = LAN743X_CSR_FLAG_SUPPORTS_INTR_AUTO_SET_CLR;
 	switch (csr->id_rev & ID_REV_CHIP_REV_MASK_) {
@@ -193,12 +188,7 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
 		break;
 	}
 
-	result = lan743x_csr_light_reset(adapter);
-	if (result)
-		goto clean_up;
-	return 0;
-clean_up:
-	return result;
+	return lan743x_csr_light_reset(adapter);
 }
 
 static void lan743x_intr_software_isr(struct lan743x_adapter *adapter)
-- 
2.41.0.rc0.172.g3f132b7071-goog


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

* Re: [PATCH net-next] net: lan743x: Remove extranous gotos
  2023-06-02  0:04 [PATCH net-next] net: lan743x: Remove extranous gotos Moritz Fischer
@ 2023-06-02  8:54 ` Siddharth Vadapalli
  2023-06-02  9:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Siddharth Vadapalli @ 2023-06-02  8:54 UTC (permalink / raw)
  To: Moritz Fischer, netdev
  Cc: pabeni, kuba, edumazet, davem, bryan.whitehead, UNGLinuxDriver,
	s-vadapalli



On 02/06/23 05:34, Moritz Fischer wrote:
> The gotos for cleanup aren't required, the function
> might as well just return the actual error code.
> 
> Signed-off-by: Moritz Fischer <moritzf@google.com>

Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>

> ---
>  drivers/net/ethernet/microchip/lan743x_main.c | 20 +++++--------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
> index 957d96a91a8a..f1bded993edc 100644
> --- a/drivers/net/ethernet/microchip/lan743x_main.c
> +++ b/drivers/net/ethernet/microchip/lan743x_main.c
> @@ -160,16 +160,13 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
>  {
>  	struct lan743x_csr *csr = &adapter->csr;
>  	resource_size_t bar_start, bar_length;
> -	int result;
>  
>  	bar_start = pci_resource_start(adapter->pdev, 0);
>  	bar_length = pci_resource_len(adapter->pdev, 0);
>  	csr->csr_address = devm_ioremap(&adapter->pdev->dev,
>  					bar_start, bar_length);
> -	if (!csr->csr_address) {
> -		result = -ENOMEM;
> -		goto clean_up;
> -	}
> +	if (!csr->csr_address)
> +		return -ENOMEM;
>  
>  	csr->id_rev = lan743x_csr_read(adapter, ID_REV);
>  	csr->fpga_rev = lan743x_csr_read(adapter, FPGA_REV);
> @@ -177,10 +174,8 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
>  		   "ID_REV = 0x%08X, FPGA_REV = %d.%d\n",
>  		   csr->id_rev,	FPGA_REV_GET_MAJOR_(csr->fpga_rev),
>  		   FPGA_REV_GET_MINOR_(csr->fpga_rev));
> -	if (!ID_REV_IS_VALID_CHIP_ID_(csr->id_rev)) {
> -		result = -ENODEV;
> -		goto clean_up;
> -	}
> +	if (!ID_REV_IS_VALID_CHIP_ID_(csr->id_rev))
> +		return -ENODEV;
>  
>  	csr->flags = LAN743X_CSR_FLAG_SUPPORTS_INTR_AUTO_SET_CLR;
>  	switch (csr->id_rev & ID_REV_CHIP_REV_MASK_) {
> @@ -193,12 +188,7 @@ static int lan743x_csr_init(struct lan743x_adapter *adapter)
>  		break;
>  	}
>  
> -	result = lan743x_csr_light_reset(adapter);
> -	if (result)
> -		goto clean_up;
> -	return 0;
> -clean_up:
> -	return result;
> +	return lan743x_csr_light_reset(adapter);
>  }
>  
>  static void lan743x_intr_software_isr(struct lan743x_adapter *adapter)

-- 
Regards,
Siddharth.

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

* Re: [PATCH net-next] net: lan743x: Remove extranous gotos
  2023-06-02  0:04 [PATCH net-next] net: lan743x: Remove extranous gotos Moritz Fischer
  2023-06-02  8:54 ` Siddharth Vadapalli
@ 2023-06-02  9:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-02  9:50 UTC (permalink / raw)
  To: Moritz Fischer
  Cc: netdev, pabeni, kuba, edumazet, davem, bryan.whitehead,
	UNGLinuxDriver

Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri,  2 Jun 2023 00:04:14 +0000 you wrote:
> The gotos for cleanup aren't required, the function
> might as well just return the actual error code.
> 
> Signed-off-by: Moritz Fischer <moritzf@google.com>
> ---
>  drivers/net/ethernet/microchip/lan743x_main.c | 20 +++++--------------
>  1 file changed, 5 insertions(+), 15 deletions(-)

Here is the summary with links:
  - [net-next] net: lan743x: Remove extranous gotos
    https://git.kernel.org/netdev/net-next/c/0f0f5868689e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-06-02  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-02  0:04 [PATCH net-next] net: lan743x: Remove extranous gotos Moritz Fischer
2023-06-02  8:54 ` Siddharth Vadapalli
2023-06-02  9:50 ` patchwork-bot+netdevbpf

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).