diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-10-04 09:05:21 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-10-05 13:16:48 +0100 |
commit | a05e4c0af490ca7c22fc77120aafebebdeaaf537 (patch) | |
tree | 093f856055c374789e43c55e5b4f8842e1f513fb /drivers/net/ethernet/sun | |
parent | 5e8fba848eaadb7394ffe88c0b2508ff2e2c9832 (diff) | |
download | linux-a05e4c0af490ca7c22fc77120aafebebdeaaf537.tar.bz2 |
ethernet: use eth_hw_addr_set() for dev->addr_len cases
Convert all Ethernet drivers from memcpy(... dev->addr_len)
to eth_hw_addr_set():
@@
expression dev, np;
@@
- memcpy(dev->dev_addr, np, dev->addr_len)
+ eth_hw_addr_set(dev, np)
In theory addr_len may not be ETH_ALEN, but we don't expect
non-Ethernet devices to live under this directory, and only
the following cases of setting addr_len exist:
- cxgb4 for mgmt device,
and the drivers which set it to ETH_ALEN: s2io, mlx4, vxge.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun')
-rw-r--r-- | drivers/net/ethernet/sun/niu.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sungem.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 825aca3c68fa..1a73a9401347 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -9235,7 +9235,7 @@ static int niu_get_of_props(struct niu *np) netdev_err(dev, "%pOF: OF MAC address prop len (%d) is wrong\n", dp, prop_len); } - memcpy(dev->dev_addr, mac_addr, dev->addr_len); + eth_hw_addr_set(dev, mac_addr); if (!is_valid_ether_addr(&dev->dev_addr[0])) { netdev_err(dev, "%pOF: OF MAC address is invalid\n", dp); netdev_err(dev, "%pOF: [ %pM ]\n", dp, dev->dev_addr); diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index a5bda9b34fba..5f786d6fa150 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c @@ -2437,7 +2437,7 @@ static int gem_set_mac_address(struct net_device *dev, void *addr) if (!is_valid_ether_addr(macaddr->sa_data)) return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len); + eth_hw_addr_set(dev, macaddr->sa_data); /* We'll just catch it later when the device is up'd or resumed */ if (!netif_running(dev) || !netif_device_present(dev)) |