Commit 872fff33 authored by wengjianfeng's avatar wengjianfeng Committed by David S. Miller

nfc/fdp: remove unnecessary assignment and label

In function fdp_nci_patch_otp and fdp_nci_patch_ram,many goto
out statements are used, and out label just return variable r.
in some places,just jump to the out label, and in other places,
assign a value to the variable r,then jump to the out label.
It is unnecessary, we just use return sentences to replace goto
sentences and delete out label.
Signed-off-by: default avatarwengjianfeng <wengjianfeng@yulong.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d567fd6e
...@@ -344,7 +344,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) ...@@ -344,7 +344,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
int r = 0; int r = 0;
if (info->otp_version >= info->otp_patch_version) if (info->otp_version >= info->otp_patch_version)
goto out; return r;
info->setup_patch_sent = 0; info->setup_patch_sent = 0;
info->setup_reset_ntf = 0; info->setup_reset_ntf = 0;
...@@ -353,19 +353,17 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) ...@@ -353,19 +353,17 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
/* Patch init request */ /* Patch init request */
r = fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_OTP); r = fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_OTP);
if (r) if (r)
goto out; return r;
/* Patch data connection creation */ /* Patch data connection creation */
conn_id = fdp_nci_create_conn(ndev); conn_id = fdp_nci_create_conn(ndev);
if (conn_id < 0) { if (conn_id < 0)
r = conn_id; return conn_id;
goto out;
}
/* Send the patch over the data connection */ /* Send the patch over the data connection */
r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_OTP); r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_OTP);
if (r) if (r)
goto out; return r;
/* Wait for all the packets to be send over i2c */ /* Wait for all the packets to be send over i2c */
wait_event_interruptible(info->setup_wq, wait_event_interruptible(info->setup_wq,
...@@ -377,13 +375,12 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) ...@@ -377,13 +375,12 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
/* Close the data connection */ /* Close the data connection */
r = nci_core_conn_close(info->ndev, conn_id); r = nci_core_conn_close(info->ndev, conn_id);
if (r) if (r)
goto out; return r;
/* Patch finish message */ /* Patch finish message */
if (fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_EOT)) { if (fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_EOT)) {
nfc_err(dev, "OTP patch error 0x%x\n", r); nfc_err(dev, "OTP patch error 0x%x\n", r);
r = -EINVAL; return -EINVAL;
goto out;
} }
/* If the patch notification didn't arrive yet, wait for it */ /* If the patch notification didn't arrive yet, wait for it */
...@@ -393,8 +390,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) ...@@ -393,8 +390,7 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
r = info->setup_patch_status; r = info->setup_patch_status;
if (r) { if (r) {
nfc_err(dev, "OTP patch error 0x%x\n", r); nfc_err(dev, "OTP patch error 0x%x\n", r);
r = -EINVAL; return -EINVAL;
goto out;
} }
/* /*
...@@ -403,7 +399,6 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev) ...@@ -403,7 +399,6 @@ static int fdp_nci_patch_otp(struct nci_dev *ndev)
*/ */
wait_event_interruptible(info->setup_wq, info->setup_reset_ntf); wait_event_interruptible(info->setup_wq, info->setup_reset_ntf);
out:
return r; return r;
} }
...@@ -415,7 +410,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) ...@@ -415,7 +410,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
int r = 0; int r = 0;
if (info->ram_version >= info->ram_patch_version) if (info->ram_version >= info->ram_patch_version)
goto out; return r;
info->setup_patch_sent = 0; info->setup_patch_sent = 0;
info->setup_reset_ntf = 0; info->setup_reset_ntf = 0;
...@@ -424,19 +419,17 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) ...@@ -424,19 +419,17 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
/* Patch init request */ /* Patch init request */
r = fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_RAM); r = fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_RAM);
if (r) if (r)
goto out; return r;
/* Patch data connection creation */ /* Patch data connection creation */
conn_id = fdp_nci_create_conn(ndev); conn_id = fdp_nci_create_conn(ndev);
if (conn_id < 0) { if (conn_id < 0)
r = conn_id; return conn_id;
goto out;
}
/* Send the patch over the data connection */ /* Send the patch over the data connection */
r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_RAM); r = fdp_nci_send_patch(ndev, conn_id, NCI_PATCH_TYPE_RAM);
if (r) if (r)
goto out; return r;
/* Wait for all the packets to be send over i2c */ /* Wait for all the packets to be send over i2c */
wait_event_interruptible(info->setup_wq, wait_event_interruptible(info->setup_wq,
...@@ -448,13 +441,12 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) ...@@ -448,13 +441,12 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
/* Close the data connection */ /* Close the data connection */
r = nci_core_conn_close(info->ndev, conn_id); r = nci_core_conn_close(info->ndev, conn_id);
if (r) if (r)
goto out; return r;
/* Patch finish message */ /* Patch finish message */
if (fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_EOT)) { if (fdp_nci_patch_cmd(ndev, NCI_PATCH_TYPE_EOT)) {
nfc_err(dev, "RAM patch error 0x%x\n", r); nfc_err(dev, "RAM patch error 0x%x\n", r);
r = -EINVAL; return -EINVAL;
goto out;
} }
/* If the patch notification didn't arrive yet, wait for it */ /* If the patch notification didn't arrive yet, wait for it */
...@@ -464,8 +456,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) ...@@ -464,8 +456,7 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
r = info->setup_patch_status; r = info->setup_patch_status;
if (r) { if (r) {
nfc_err(dev, "RAM patch error 0x%x\n", r); nfc_err(dev, "RAM patch error 0x%x\n", r);
r = -EINVAL; return -EINVAL;
goto out;
} }
/* /*
...@@ -474,7 +465,6 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev) ...@@ -474,7 +465,6 @@ static int fdp_nci_patch_ram(struct nci_dev *ndev)
*/ */
wait_event_interruptible(info->setup_wq, info->setup_reset_ntf); wait_event_interruptible(info->setup_wq, info->setup_reset_ntf);
out:
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment