Skip to contentSkip to conversation

staging: octeon: Replace memcpy with ETH_ALEN

PATCH In review Balavasu 2 participants 2 messages Oct 17, 2014

Subsystems (3)
lore
Share & tools
lore

Balavasu

author
#0 lore raw

PATCH 1/1 staging: octeon: Replace memcpy with ETH_ALEN

This patch fixes the checkpatch.pl issue
WARNING: memcpy(dev->dev_addr, mac, ETH_ALEN);

---
 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/octeon/ethernet.c +1 -1
index 8f9e3fb..47d4277 100644
@@ -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);
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Balavasu

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.

drivers/staging/octeon/ethernet.c

Quoted 1 line
drivers/staging/octeon/ethernet.c +0 -0

[]

Quoted 9 lines
drivers/staging/octeon/ethernet.c +1 -1
@@ -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);