diff options
Diffstat (limited to 'drivers/net/ethernet/amd/pcnet32.c')
-rw-r--r-- | drivers/net/ethernet/amd/pcnet32.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index 70d76fdb9f56..f5c50ff377ff 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c @@ -1595,6 +1595,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) struct net_device *dev; const struct pcnet32_access *a = NULL; u8 promaddr[ETH_ALEN]; + u8 addr[ETH_ALEN]; int ret = -ENODEV; /* reset the chip */ @@ -1760,9 +1761,10 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) unsigned int val; val = a->read_csr(ioaddr, i + 12) & 0x0ffff; /* There may be endianness issues here. */ - dev->dev_addr[2 * i] = val & 0x0ff; - dev->dev_addr[2 * i + 1] = (val >> 8) & 0x0ff; + addr[2 * i] = val & 0x0ff; + addr[2 * i + 1] = (val >> 8) & 0x0ff; } + eth_hw_addr_set(dev, addr); /* read PROM address and compare with CSR address */ for (i = 0; i < ETH_ALEN; i++) @@ -1775,13 +1777,16 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) pr_cont(" warning: CSR address invalid,\n"); pr_info(" using instead PROM address of"); } - memcpy(dev->dev_addr, promaddr, ETH_ALEN); + eth_hw_addr_set(dev, promaddr); } } /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ - if (!is_valid_ether_addr(dev->dev_addr)) - eth_zero_addr(dev->dev_addr); + if (!is_valid_ether_addr(dev->dev_addr)) { + static const u8 zero_addr[ETH_ALEN] = {}; + + eth_hw_addr_set(dev, zero_addr); + } if (pcnet32_debug & NETIF_MSG_PROBE) { pr_cont(" %pM", dev->dev_addr); |