[PATCH 2/3] staging: vt6656: Use return instead of goto

From: Oscar Carter
Date: Sat Apr 25 2020 - 08:39:55 EST


Replace the "goto" statements with a direct "return ret" as the jump
label only returns the ret variable.

Also, remove the unnecessary variable initialization because the ret
variable is set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@xxxxxxx>
---
drivers/staging/vt6656/rf.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 82d3b6081b5b..888b6fcb6e91 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -766,7 +766,7 @@ void vnt_rf_rssi_to_dbm(struct vnt_private *priv, u8 rssi, long *dbm)

int vnt_rf_table_download(struct vnt_private *priv)
{
- int ret = 0;
+ int ret;
u16 length1 = 0, length2 = 0, length3 = 0;
u8 *addr1 = NULL, *addr2 = NULL, *addr3 = NULL;
u16 length, value;
@@ -819,7 +819,7 @@ int vnt_rf_table_download(struct vnt_private *priv)
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
MESSAGE_REQUEST_RF_INIT, length1, addr1);
if (ret)
- goto end;
+ return ret;

/* Channel Table 0 */
value = 0;
@@ -832,7 +832,7 @@ int vnt_rf_table_download(struct vnt_private *priv)
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
MESSAGE_REQUEST_RF_CH0, length, addr2);
if (ret)
- goto end;
+ return ret;

length2 -= length;
value += length;
@@ -850,7 +850,7 @@ int vnt_rf_table_download(struct vnt_private *priv)
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
MESSAGE_REQUEST_RF_CH1, length, addr3);
if (ret)
- goto end;
+ return ret;

length3 -= length;
value += length;
@@ -867,7 +867,7 @@ int vnt_rf_table_download(struct vnt_private *priv)
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
MESSAGE_REQUEST_RF_INIT2, length1, addr1);
if (ret)
- goto end;
+ return ret;

/* Channel Table 0 */
value = 0;
@@ -881,7 +881,7 @@ int vnt_rf_table_download(struct vnt_private *priv)
MESSAGE_REQUEST_RF_CH2, length,
addr2);
if (ret)
- goto end;
+ return ret;

length2 -= length;
value += length;
@@ -889,6 +889,5 @@ int vnt_rf_table_download(struct vnt_private *priv)
}
}

-end:
- return ret;
+ return 0;
}
--
2.20.1