net: ethoc: Use ether_addr_copy()
Use ether_addr_copy() instead of memcpy() to set netdev->dev_addr (which is 2-byte aligned). Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Reviewed-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
0ed4844097
commit
de6b08fd82
@@ -1148,14 +1148,14 @@ static int ethoc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* Allow the platform setup code to pass in a MAC address. */
|
/* Allow the platform setup code to pass in a MAC address. */
|
||||||
if (pdata) {
|
if (pdata) {
|
||||||
memcpy(netdev->dev_addr, pdata->hwaddr, IFHWADDRLEN);
|
ether_addr_copy(netdev->dev_addr, pdata->hwaddr);
|
||||||
priv->phy_id = pdata->phy_id;
|
priv->phy_id = pdata->phy_id;
|
||||||
} else {
|
} else {
|
||||||
const void *mac;
|
const void *mac;
|
||||||
|
|
||||||
mac = of_get_mac_address(pdev->dev.of_node);
|
mac = of_get_mac_address(pdev->dev.of_node);
|
||||||
if (mac)
|
if (mac)
|
||||||
memcpy(netdev->dev_addr, mac, IFHWADDRLEN);
|
ether_addr_copy(netdev->dev_addr, mac);
|
||||||
priv->phy_id = -1;
|
priv->phy_id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user