* [PATCH] staging: octeon: Replace memcpy with ETH_ALEN
@ 2014-10-17 18:47 Balavasu
2014-10-17 19:40 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Balavasu @ 2014-10-17 18:47 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
This patch fixes the checkpatch.pl issue
WARNING: memcpy(dev->dev_addr, mac, ETH_ALEN);
Signed-off-by: Balavasu <kp.balavasu@gmail.com>
---
drivers/staging/octeon/ethernet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 8f9e3fb..47d4277 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -452,7 +452,7 @@ int cvm_oct_common_init(struct net_device *dev)
mac = of_get_mac_address(priv->of_node);
if (mac)
- memcpy(dev->dev_addr, mac, ETH_ALEN);
+ ether_addr_copy(dev->dev_addr, mac);
else
eth_hw_addr_random(dev);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: octeon: Replace memcpy with ETH_ALEN
2014-10-17 18:47 [PATCH] staging: octeon: Replace memcpy with ETH_ALEN Balavasu
@ 2014-10-17 19:40 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2014-10-17 19:40 UTC (permalink / raw)
To: Balavasu; +Cc: netdev, linux-kernel
On Sat, 2014-10-18 at 00:17 +0530, Balavasu wrote:
> This patch fixes the checkpatch.pl issue
> WARNING: memcpy(dev->dev_addr, mac, ETH_ALEN);
That is not the actual warning.
This is the warning:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
How have you made sure that mac can not have odd alignment?
Make sure your commit message shows how you know
that mac is appropriately aligned.
> diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
[]
> @@ -452,7 +452,7 @@ int cvm_oct_common_init(struct net_device *dev)
> mac = of_get_mac_address(priv->of_node);
>
> if (mac)
> - memcpy(dev->dev_addr, mac, ETH_ALEN);
> + ether_addr_copy(dev->dev_addr, mac);
> else
> eth_hw_addr_random(dev);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-17 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-17 18:47 [PATCH] staging: octeon: Replace memcpy with ETH_ALEN Balavasu
2014-10-17 19:40 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).