[30/32] net/ice: replace memcpy with structure assignment

Message ID 20250208203142.242284-31-stephen@networkplumber.org (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series Use structure assignment instead of memcpy |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 8, 2025, 8:22 p.m. UTC
Prefer structure assignment over memcpy.
Found by struct-assign.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/intel/ice/ice_hash.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/net/intel/ice/ice_hash.c b/drivers/net/intel/ice/ice_hash.c
index 00d65bc637..aa6a21c055 100644
--- a/drivers/net/intel/ice/ice_hash.c
+++ b/drivers/net/intel/ice/ice_hash.c
@@ -1309,8 +1309,7 @@  ice_hash_create(struct ice_adapter *ad,
 		goto out;
 	} else {
 		if (rss_meta->raw.raw_ena) {
-			memcpy(&filter_ptr->rss_cfg.raw, &rss_meta->raw,
-			       sizeof(struct ice_rss_raw_cfg));
+			filter_ptr->rss_cfg.raw = rss_meta->raw;
 			ret = ice_hash_add_raw_cfg(ad, &rss_meta->raw,
 						   pf->main_vsi->idx);
 			if (ret) {
@@ -1321,8 +1320,7 @@  ice_hash_create(struct ice_adapter *ad,
 				goto error;
 			}
 		} else {
-			memcpy(&filter_ptr->rss_cfg.hash, &rss_meta->cfg,
-			       sizeof(struct ice_rss_hash_cfg));
+			filter_ptr->rss_cfg.hash = rss_meta->cfg;
 			ret = ice_add_rss_cfg_wrap(pf, vsi->idx,
 						   &filter_ptr->rss_cfg.hash);
 			if (ret) {