diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-10-04 18:05:21 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-10-05 14:16:48 +0200 |
commit | a05e4c0af490ca7c22fc77120aafebebdeaaf537 (patch) | |
tree | 093f856055c374789e43c55e5b4f8842e1f513fb /drivers/net/ethernet/micrel/ks8842.c | |
parent | Merge branch 'mlx4-const-dev_addr' (diff) | |
download | linux-a05e4c0af490ca7c22fc77120aafebebdeaaf537.tar.xz linux-a05e4c0af490ca7c22fc77120aafebebdeaaf537.zip |
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/micrel/ks8842.c')
-rw-r--r-- | drivers/net/ethernet/micrel/ks8842.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c index b27713906d3a..37ccf8c570b5 100644 --- a/drivers/net/ethernet/micrel/ks8842.c +++ b/drivers/net/ethernet/micrel/ks8842.c @@ -1064,7 +1064,7 @@ static int ks8842_set_mac(struct net_device *netdev, void *p) if (!is_valid_ether_addr(addr->sa_data)) return -EADDRNOTAVAIL; - memcpy(netdev->dev_addr, mac, netdev->addr_len); + eth_hw_addr_set(netdev, mac); ks8842_write_mac_addr(adapter, mac); return 0; @@ -1191,8 +1191,7 @@ static int ks8842_probe(struct platform_device *pdev) if (i < netdev->addr_len) /* an address was passed, use it */ - memcpy(netdev->dev_addr, pdata->macaddr, - netdev->addr_len); + eth_hw_addr_set(netdev, pdata->macaddr); } if (i == netdev->addr_len) { |