diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index baa9f5d1c549f6be2bdcab3501acd1eaa128c394..de7d8bf2c226fa1e457dd96c2027a45b6c8ab4e4 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -2037,13 +2037,15 @@ static int netsec_probe(struct platform_device *pdev) if (ret && priv->eeprom_base) { void __iomem *macp = priv->eeprom_base + NETSEC_EEPROM_MAC_ADDRESS; - - ndev->dev_addr[0] = readb(macp + 3); - ndev->dev_addr[1] = readb(macp + 2); - ndev->dev_addr[2] = readb(macp + 1); - ndev->dev_addr[3] = readb(macp + 0); - ndev->dev_addr[4] = readb(macp + 7); - ndev->dev_addr[5] = readb(macp + 6); + u8 addr[ETH_ALEN]; + + addr[0] = readb(macp + 3); + addr[1] = readb(macp + 2); + addr[2] = readb(macp + 1); + addr[3] = readb(macp + 0); + addr[4] = readb(macp + 7); + addr[5] = readb(macp + 6); + eth_hw_addr_set(ndev, addr); } if (!is_valid_ether_addr(ndev->dev_addr)) { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index b720539ccb0aaeb1c31d5dfca8c66c7f890658ee..88d3053d2f877e0d1847bda8573e191e5e12cd57 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2818,9 +2818,13 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) */ static void stmmac_check_ether_addr(struct stmmac_priv *priv) { + u8 addr[ETH_ALEN]; + if (!is_valid_ether_addr(priv->dev->dev_addr)) { - stmmac_get_umac_addr(priv, priv->hw, priv->dev->dev_addr, 0); - if (!is_valid_ether_addr(priv->dev->dev_addr)) + stmmac_get_umac_addr(priv, priv->hw, addr, 0); + if (is_valid_ether_addr(addr)) + eth_hw_addr_set(priv->dev, addr); + else eth_hw_addr_random(priv->dev); dev_info(priv->device, "device MAC address %pM\n", priv->dev->dev_addr); diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index 3e8a3fde8302cef3b979fb6c66adb3977b451bad..0775a5542f2f925a9cdd5d2ab7a5cc63a957fc8e 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -840,6 +840,7 @@ static int bdx_set_mac(struct net_device *ndev, void *p) static int bdx_read_mac(struct bdx_priv *priv) { u16 macAddress[3], i; + u8 addr[ETH_ALEN]; ENTER; macAddress[2] = READ_REG(priv, regUNC_MAC0_A); @@ -849,9 +850,10 @@ static int bdx_read_mac(struct bdx_priv *priv) macAddress[0] = READ_REG(priv, regUNC_MAC2_A); macAddress[0] = READ_REG(priv, regUNC_MAC2_A); for (i = 0; i < 3; i++) { - priv->ndev->dev_addr[i * 2 + 1] = macAddress[i]; - priv->ndev->dev_addr[i * 2] = macAddress[i] >> 8; + addr[i * 2 + 1] = macAddress[i]; + addr[i * 2] = macAddress[i] >> 8; } + eth_hw_addr_set(priv->ndev, addr); RET(0); } diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c index eab7d78d7c720dbcc4582012daadf61e13ffe16e..741c42c6a41776f6256c44e9210adbf170f7df00 100644 --- a/drivers/net/ethernet/ti/tlan.c +++ b/drivers/net/ethernet/ti/tlan.c @@ -817,6 +817,7 @@ static int tlan_init(struct net_device *dev) int err; int i; struct tlan_priv *priv; + u8 addr[ETH_ALEN]; priv = netdev_priv(dev); @@ -842,7 +843,7 @@ static int tlan_init(struct net_device *dev) for (i = 0; i < ETH_ALEN; i++) err |= tlan_ee_read_byte(dev, (u8) priv->adapter->addr_ofs + i, - (u8 *) &dev->dev_addr[i]); + addr + i); if (err) { pr_err("%s: Error reading MAC from eeprom: %d\n", dev->name, err); @@ -850,11 +851,12 @@ static int tlan_init(struct net_device *dev) /* Olicom OC-2325/OC-2326 have the address byte-swapped */ if (priv->adapter->addr_ofs == 0xf8) { for (i = 0; i < ETH_ALEN; i += 2) { - char tmp = dev->dev_addr[i]; - dev->dev_addr[i] = dev->dev_addr[i + 1]; - dev->dev_addr[i + 1] = tmp; + char tmp = addr[i]; + addr[i] = addr[i + 1]; + addr[i + 1] = tmp; } } + eth_hw_addr_set(dev, addr); netif_carrier_off(dev); diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 3b73a9c55a5a7653c124f0a2069b812b1ad049af..509c5e9b29dfa4174b8c3b8597ffe1bafede9294 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c @@ -899,6 +899,7 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks, struct net_device *dev; struct rhine_private *rp; int i, rc, phy_id; + u8 addr[ETH_ALEN]; const char *name; /* this should always be supported */ @@ -933,7 +934,8 @@ static int rhine_init_one_common(struct device *hwdev, u32 quirks, rhine_hw_init(dev, pioaddr); for (i = 0; i < 6; i++) - dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); + addr[i] = ioread8(ioaddr + StationAddr + i); + eth_hw_addr_set(dev, addr); if (!is_valid_ether_addr(dev->dev_addr)) { /* Report it and use a random ethernet address instead */ diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 4b9c30f735b560f35a956d1fd6eb0f6dc4ab6cfc..be2b992f24d99c6500ff0dad5667c4a016fd0206 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c @@ -2767,6 +2767,7 @@ static int velocity_probe(struct device *dev, int irq, struct velocity_info *vptr; struct mac_regs __iomem *regs; int ret = -ENOMEM; + u8 addr[ETH_ALEN]; /* FIXME: this driver, like almost all other ethernet drivers, * can support more than MAX_UNITS. @@ -2820,7 +2821,8 @@ static int velocity_probe(struct device *dev, int irq, mac_wol_reset(regs); for (i = 0; i < 6; i++) - netdev->dev_addr[i] = readb(®s->PAR[i]); + addr[i] = readb(®s->PAR[i]); + eth_hw_addr_set(netdev, addr); velocity_get_options(&vptr->options, velocity_nics);