Skip to contentSkip to conversation

Staging: vt6656: replace memcpy by ether_addr_copy

PATCH In review Yeliz Taneroglu 2 participants 2 messages Feb 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: vt6656: replace memcpy by ether_addr_copy

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

---
 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -1
index 2fbff90..27a1f98 100644
@@ -319,7 +319,7 @@ static int vnt_init_registers(struct vnt_private *priv)
 
 	/* get permanent network address */
 	memcpy(priv->permanent_net_addr, init_rsp->net_addr, 6);
-	memcpy(priv->current_net_addr, priv->permanent_net_addr, ETH_ALEN);
+	ether_addr_copy(priv->current_net_addr, priv->permanent_net_addr);
 
 	/* if exist SW network address, use it */
 	dev_dbg(&priv->usb->dev, "Network address = %pM\n",
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 4 lines · Yeliz Taneroglu

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

You should explain why the address is aligned. Perhaps the tool pahole can be helpful.

julia

Quoted 29 lines
---
 drivers/staging/vt6656/main_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/main_usb.c +1 -2
index 2fbff90..27a1f98 100644
@@ -319,7 +319,7 @@ static int vnt_init_registers(struct vnt_private *priv)
 
 	/* get permanent network address */
 	memcpy(priv->permanent_net_addr, init_rsp->net_addr, 6);
-	memcpy(priv->current_net_addr, priv->permanent_net_addr, ETH_ALEN);
+	ether_addr_copy(priv->current_net_addr, priv->permanent_net_addr);
 
 	/* if exist SW network address, use it */
 	dev_dbg(&priv->usb->dev, "Network address = %pM\n",
--

1.8.3.2

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1424518321-5700-1-git-send-email-yeliztaneroglu%40gmail.com.
For more options, visit https://groups.google.com/d/optout.