Skip to content

Commit

Permalink
nfc: s3fwrn5: remove unnecessary label
Browse files Browse the repository at this point in the history
Simplify the code by removing unnecessary label and returning directly.

Signed-off-by: wengjianfeng <wengjianfeng@yulong.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
wengjianfeng authored and David S. Miller committed Jul 26, 2021
1 parent 8f49efc commit a0302ff
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/nfc/s3fwrn5/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */
Expand All @@ -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) {
Expand All @@ -455,21 +454,20 @@ 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;
}
}

ret = s3fwrn5_fw_complete_update_mode(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;
}

Expand Down

0 comments on commit a0302ff

Please sign in to comment.