Prefer structure assignment over memcpy.
Found by struct-assign.cocci.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/ntnic/nthw/flow_api/flow_id_table.c | 4 ++--
.../nthw/flow_api/profile_inline/flow_api_profile_inline.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
@@ -99,7 +99,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t
struct ntnic_id_table_element *element = ntnic_id_table_array_find_element(handle, new_id);
element->caller_id = caller_id;
element->type = type;
- memcpy(&element->handle, &flm_h, sizeof(union flm_handles));
+ element->handle = flm_h;
rte_spinlock_unlock(&handle->mtx);
@@ -139,7 +139,7 @@ void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h,
*caller_id = element->caller_id;
*type = element->type;
- memcpy(flm_h, &element->handle, sizeof(union flm_handles));
+ *flm_h = element->handle;
rte_spinlock_unlock(&handle->mtx);
}
@@ -3099,7 +3099,7 @@ static int convert_fh_to_fh_flm(struct flow_handle *fh, const uint32_t *packet_d
if (fh->type != FLOW_HANDLE_TYPE_FLOW)
return -1;
- memcpy(&fh_copy, fh, sizeof(struct flow_handle));
+ fh_copy = *fh;
memset(fh, 0x0, sizeof(struct flow_handle));
fd = fh_copy.fd;