Commit c51e5062 authored by Jakub Kicinski's avatar Jakub Kicinski

ethernet: manually convert memcpy(dev_addr,..., sizeof(addr))

A handful of drivers use sizeof(addr) for the size of
the address, after manually confirming the size is
indeed 6 convert them to eth_hw_addr_set().
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarPetko Manolov <petkan@nucleusys.com>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent db0dcc6a
...@@ -313,7 +313,7 @@ static void macb_get_hwaddr(struct macb *bp) ...@@ -313,7 +313,7 @@ static void macb_get_hwaddr(struct macb *bp)
addr[5] = (top >> 8) & 0xff; addr[5] = (top >> 8) & 0xff;
if (is_valid_ether_addr(addr)) { if (is_valid_ether_addr(addr)) {
memcpy(bp->dev->dev_addr, addr, sizeof(addr)); eth_hw_addr_set(bp->dev, addr);
return; return;
} }
} }
......
...@@ -93,7 +93,7 @@ static void dnet_get_hwaddr(struct dnet *bp) ...@@ -93,7 +93,7 @@ static void dnet_get_hwaddr(struct dnet *bp)
*((__be16 *)(addr + 4)) = cpu_to_be16(tmp); *((__be16 *)(addr + 4)) = cpu_to_be16(tmp);
if (is_valid_ether_addr(addr)) if (is_valid_ether_addr(addr))
memcpy(bp->dev->dev_addr, addr, sizeof(addr)); eth_hw_addr_set(bp->dev, addr);
} }
static int dnet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) static int dnet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
......
...@@ -1722,7 +1722,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1722,7 +1722,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
memcpy(dev->dev_addr, mac->mac_addr, sizeof(mac->mac_addr)); eth_hw_addr_set(dev, mac->mac_addr);
ret = mac_to_intf(mac); ret = mac_to_intf(mac);
if (ret < 0) { if (ret < 0) {
......
...@@ -1112,7 +1112,7 @@ static int cpmac_probe(struct platform_device *pdev) ...@@ -1112,7 +1112,7 @@ static int cpmac_probe(struct platform_device *pdev)
priv->dev = dev; priv->dev = dev;
priv->ring_size = 64; priv->ring_size = 64;
priv->msg_enable = netif_msg_init(debug_level, 0xff); priv->msg_enable = netif_msg_init(debug_level, 0xff);
memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr)); eth_hw_addr_set(dev, pdata->dev_addr);
snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT,
mdio_bus_id, phy_id); mdio_bus_id, phy_id);
......
...@@ -357,7 +357,7 @@ static void set_ethernet_addr(pegasus_t *pegasus) ...@@ -357,7 +357,7 @@ static void set_ethernet_addr(pegasus_t *pegasus)
goto err; goto err;
} }
memcpy(pegasus->net->dev_addr, node_id, sizeof(node_id)); eth_hw_addr_set(pegasus->net, node_id);
return; return;
err: err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment