[PATCH 1/3] staging: vt6656: Remove the local variable "array"

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


Remove the local variable "array" and all the memcpy function calls
because this copy operation from different arrays to this variable is
unnecessary.

The same result can be achieved using the arrays directly.

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

diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 06fa8867cfa3..82d3b6081b5b 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -770,7 +770,6 @@ int vnt_rf_table_download(struct vnt_private *priv)
u16 length1 = 0, length2 = 0, length3 = 0;
u8 *addr1 = NULL, *addr2 = NULL, *addr3 = NULL;
u16 length, value;
- u8 array[256];

switch (priv->rf_type) {
case RF_AL2230:
@@ -817,10 +816,8 @@ int vnt_rf_table_download(struct vnt_private *priv)
}

/* Init Table */
- memcpy(array, addr1, length1);
-
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
- MESSAGE_REQUEST_RF_INIT, length1, array);
+ MESSAGE_REQUEST_RF_INIT, length1, addr1);
if (ret)
goto end;

@@ -832,10 +829,8 @@ int vnt_rf_table_download(struct vnt_private *priv)
else
length = length2;

- memcpy(array, addr2, length);
-
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
- MESSAGE_REQUEST_RF_CH0, length, array);
+ MESSAGE_REQUEST_RF_CH0, length, addr2);
if (ret)
goto end;

@@ -852,10 +847,8 @@ int vnt_rf_table_download(struct vnt_private *priv)
else
length = length3;

- memcpy(array, addr3, length);
-
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
- MESSAGE_REQUEST_RF_CH1, length, array);
+ MESSAGE_REQUEST_RF_CH1, length, addr3);
if (ret)
goto end;

@@ -870,11 +863,9 @@ int vnt_rf_table_download(struct vnt_private *priv)
addr1 = &al7230_init_table_amode[0][0];
addr2 = &al7230_channel_table2[0][0];

- memcpy(array, addr1, length1);
-
/* Init Table 2 */
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
- MESSAGE_REQUEST_RF_INIT2, length1, array);
+ MESSAGE_REQUEST_RF_INIT2, length1, addr1);
if (ret)
goto end;

@@ -886,11 +877,9 @@ int vnt_rf_table_download(struct vnt_private *priv)
else
length = length2;

- memcpy(array, addr2, length);
-
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, value,
MESSAGE_REQUEST_RF_CH2, length,
- array);
+ addr2);
if (ret)
goto end;

--
2.20.1