Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] nfc: s3fwrn5: remove unnecessary label
@ 2021-04-02 12:15 samirweng1979
  2021-04-02 16:28 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 5+ messages in thread
From: samirweng1979 @ 2021-04-02 12:15 UTC (permalink / raw)
  To: krzysztof.kozlowski, k.opasiak
  Cc: linux-nfc, netdev, linux-kernel, wengjianfeng

From: wengjianfeng <wengjianfeng@yulong.com>

In function s3fwrn5_nci_post_setup, The variable ret is assigned to 0,
then goto out label, but just return ret in out label, so we use
return 0 to replace it. and other goto sentences are similar, we use
return sentences to replace it and delete out label.

Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
---
 drivers/nfc/s3fwrn5/core.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/nfc/s3fwrn5/core.c b/drivers/nfc/s3fwrn5/core.c
index c00b7a0..865d3e3 100644
--- a/drivers/nfc/s3fwrn5/core.c
+++ b/drivers/nfc/s3fwrn5/core.c
@@ -124,13 +124,12 @@ static int s3fwrn5_nci_post_setup(struct nci_dev *ndev)
 
 	if (s3fwrn5_firmware_init(info)) {
 		//skip bootloader mode
-		ret = 0;
-		goto out;
+		return 0;
 	}
 
 	ret = s3fwrn5_firmware_update(info);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	/* NCI core reset */
 
@@ -139,12 +138,9 @@ static int s3fwrn5_nci_post_setup(struct nci_dev *ndev)
 
 	ret = nci_core_reset(info->ndev);
 	if (ret < 0)
-		goto out;
-
-	ret = nci_core_init(info->ndev);
+		return ret;
 
-out:
-	return ret;
+	return nci_core_init(info->ndev);
 }
 
 static struct nci_ops s3fwrn5_nci_ops = {
-- 
1.9.1



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

* Re: [PATCH] nfc: s3fwrn5: remove unnecessary label
  2021-04-02 12:15 [PATCH] nfc: s3fwrn5: remove unnecessary label samirweng1979
@ 2021-04-02 16:28 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2021-04-02 16:28 UTC (permalink / raw)
  To: samirweng1979, k.opasiak; +Cc: linux-nfc, netdev, linux-kernel, wengjianfeng

On 02/04/2021 14:15, samirweng1979 wrote:
> From: wengjianfeng <wengjianfeng@yulong.com>
> 
> In function s3fwrn5_nci_post_setup, The variable ret is assigned to 0,
> then goto out label, but just return ret in out label, so we use
> return 0 to replace it. and other goto sentences are similar, we use
> return sentences to replace it and delete out label.

The message is difficult to understand - you created one long sentence
with mixing tenses and subjects. "The" starts capital in the middle of
sentence but "and" starts after full stop.

Please rephrase it.

The code itself looks ok.

Best regards,
Krzysztof

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

* Re: [PATCH] nfc: s3fwrn5: remove unnecessary label
  2021-07-26  3:29 samirweng1979
  2021-07-26  7:55 ` Krzysztof Kozlowski
@ 2021-07-26 11:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-26 11:30 UTC (permalink / raw)
  To: samirweng1979
  Cc: krzysztof.kozlowski, k.opasiak, netdev, linux-kernel, wengjianfeng

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Mon, 26 Jul 2021 11:29:17 +0800 you wrote:
> From: wengjianfeng <wengjianfeng@yulong.com>
> 
> Simplify the code by removing unnecessary label and returning directly.
> 
> Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
> ---
>  drivers/nfc/s3fwrn5/firmware.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)

Here is the summary with links:
  - nfc: s3fwrn5: remove unnecessary label
    https://git.kernel.org/netdev/net-next/c/a0302ff5906a

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] 5+ messages in thread

* Re: [PATCH] nfc: s3fwrn5: remove unnecessary label
  2021-07-26  3:29 samirweng1979
@ 2021-07-26  7:55 ` Krzysztof Kozlowski
  2021-07-26 11:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2021-07-26  7:55 UTC (permalink / raw)
  To: samirweng1979, k.opasiak; +Cc: netdev, linux-kernel, wengjianfeng

On 26/07/2021 05:29, samirweng1979 wrote:
> From: wengjianfeng <wengjianfeng@yulong.com>
> 
> Simplify the code by removing unnecessary label and returning directly.
> 
> Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
> ---
>  drivers/nfc/s3fwrn5/firmware.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

Best regards,
Krzysztof

> diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
> index eb5d7a5b..1421ffd 100644
> --- a/drivers/nfc/s3fwrn5/firmware.c
> +++ b/drivers/nfc/s3fwrn5/firmware.c
> @@ -421,10 +421,9 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
>  
>  	tfm = crypto_alloc_shash("sha1", 0, 0);
>  	if (IS_ERR(tfm)) {
> -		ret = PTR_ERR(tfm);
>  		dev_err(&fw_info->ndev->nfc_dev->dev,
>  			"Cannot allocate shash (code=%d)\n", ret);
> -		goto out;
> +		return PTR_ERR(tfm);
>  	}
>  
>  	ret = crypto_shash_tfm_digest(tfm, fw->image, image_size, hash_data);
> @@ -433,7 +432,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
>  	if (ret) {
>  		dev_err(&fw_info->ndev->nfc_dev->dev,
>  			"Cannot compute hash (code=%d)\n", ret);
> -		goto out;
> +		return ret;
>  	}
>  
>  	/* Firmware update process */
> @@ -446,7 +445,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
>  	if (ret < 0) {
>  		dev_err(&fw_info->ndev->nfc_dev->dev,
>  			"Unable to enter update mode\n");
> -		goto out;
> +		return ret;
>  	}
>  
>  	for (off = 0; off < image_size; off += fw_info->sector_size) {
> @@ -455,7 +454,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
>  		if (ret < 0) {
>  			dev_err(&fw_info->ndev->nfc_dev->dev,
>  				"Firmware update error (code=%d)\n", ret);
> -			goto out;
> +			return ret;
>  		}
>  	}
>  
> @@ -463,13 +462,12 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
>  	if (ret < 0) {
>  		dev_err(&fw_info->ndev->nfc_dev->dev,
>  			"Unable to complete update mode\n");
> -		goto out;
> +		return ret;
>  	}
>  
>  	dev_info(&fw_info->ndev->nfc_dev->dev,
>  		"Firmware update: success\n");
>  
> -out:
>  	return ret;
>  }
>  
> 

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

* [PATCH] nfc: s3fwrn5: remove unnecessary label
@ 2021-07-26  3:29 samirweng1979
  2021-07-26  7:55 ` Krzysztof Kozlowski
  2021-07-26 11:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: samirweng1979 @ 2021-07-26  3:29 UTC (permalink / raw)
  To: krzysztof.kozlowski, k.opasiak; +Cc: netdev, linux-kernel, wengjianfeng

From: wengjianfeng <wengjianfeng@yulong.com>

Simplify the code by removing unnecessary label and returning directly.

Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
---
 drivers/nfc/s3fwrn5/firmware.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/nfc/s3fwrn5/firmware.c b/drivers/nfc/s3fwrn5/firmware.c
index eb5d7a5b..1421ffd 100644
--- a/drivers/nfc/s3fwrn5/firmware.c
+++ b/drivers/nfc/s3fwrn5/firmware.c
@@ -421,10 +421,9 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
 
 	tfm = crypto_alloc_shash("sha1", 0, 0);
 	if (IS_ERR(tfm)) {
-		ret = PTR_ERR(tfm);
 		dev_err(&fw_info->ndev->nfc_dev->dev,
 			"Cannot allocate shash (code=%d)\n", ret);
-		goto out;
+		return PTR_ERR(tfm);
 	}
 
 	ret = crypto_shash_tfm_digest(tfm, fw->image, image_size, hash_data);
@@ -433,7 +432,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
 	if (ret) {
 		dev_err(&fw_info->ndev->nfc_dev->dev,
 			"Cannot compute hash (code=%d)\n", ret);
-		goto out;
+		return ret;
 	}
 
 	/* Firmware update process */
@@ -446,7 +445,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
 	if (ret < 0) {
 		dev_err(&fw_info->ndev->nfc_dev->dev,
 			"Unable to enter update mode\n");
-		goto out;
+		return ret;
 	}
 
 	for (off = 0; off < image_size; off += fw_info->sector_size) {
@@ -455,7 +454,7 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
 		if (ret < 0) {
 			dev_err(&fw_info->ndev->nfc_dev->dev,
 				"Firmware update error (code=%d)\n", ret);
-			goto out;
+			return ret;
 		}
 	}
 
@@ -463,13 +462,12 @@ int s3fwrn5_fw_download(struct s3fwrn5_fw_info *fw_info)
 	if (ret < 0) {
 		dev_err(&fw_info->ndev->nfc_dev->dev,
 			"Unable to complete update mode\n");
-		goto out;
+		return ret;
 	}
 
 	dev_info(&fw_info->ndev->nfc_dev->dev,
 		"Firmware update: success\n");
 
-out:
 	return ret;
 }
 
-- 
1.9.1



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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 12:15 [PATCH] nfc: s3fwrn5: remove unnecessary label samirweng1979
2021-04-02 16:28 ` Krzysztof Kozlowski
2021-07-26  3:29 samirweng1979
2021-07-26  7:55 ` Krzysztof Kozlowski
2021-07-26 11:30 ` 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).