ethdev: replace rte_memcpy with assignment
PATCH 1/1 ethdev: replace rte_memcpy with assignment
Can use structure assignment instead of rte_memcpy here.
Signed-off-by Stephen Hemminger <[email protected]>
--- lib/ethdev/rte_ethdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/ethdev/rte_ethdev.c +1 -2
@@ -16,7 +16,6 @@#include <rte_log.h> #include <rte_interrupts.h> #include <rte_kvargs.h> -#include <rte_memcpy.h> #include <rte_common.h> #include <rte_mempool.h> #include <rte_malloc.h>
@@ -631,7 +630,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)rte_spinlock_lock (rte_mcfg_ethdev_get_lock ());if (eth_dev_shared_data_prepare () !=NULL ) { -rte_memcpy (owner, ðdev->data->owner,sizeof (*owner)); + *owner = ethdev->data->owner; ret =0 ; }else { ret = -ENOMEM ;
Signature · 1 line
2.53.0
Quoted 1 line · Stephen Hemminger
Can use structure assignment instead of
rte_memcpyhere.
It would be useful to mention in the description or summary why it is better.
Right now the description say what is done, but it is obvious from the code change.
Quoted 27 lines
Signed-off-by Stephen Hemminger <[email protected]>--- lib/ethdev/rte_ethdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)lib/ethdev/rte_ethdev.c +1
-2@@ -16,7 +16,6 @@#include <rte_log.h> #include <rte_interrupts.h> #include <rte_kvargs.h> -#include <rte_memcpy.h> #include <rte_common.h> #include <rte_mempool.h> #include <rte_malloc.h> @@ -631,7 +630,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)rte_spinlock_lock (rte_mcfg_ethdev_get_lock ());if (eth_dev_shared_data_prepare () !=NULL ) { -rte_memcpy (owner, ðdev->data->owner,sizeof (*owner)); + *owner = ethdev->data->owner; ret =0 ; }else { ret = -ENOMEM ;
Quoted 8 lines · On Thu, 1 Oct 2026 11:14:13 +0300 Andrew Rybchenko…
Quoted 1 line · Stephen Hemminger
Can use structure assignment instead of
rte_memcpyhere.It would be useful to mention in the description or summary why it is better.
Right now the description say what is done, but it is obvious from the code change.
I thought it was obvious, it is mentioned in AGENTS.md and there is a coccinelle script that finds places like this.