Skip to content

Commit 482e3fe

Browse files
JoePerchesdavem330
authored andcommitted
via-rhine: Assign random MAC address if necessary
Roger Luethi has had several reports of Rhine NICs providing an invalid MAC address. If so, assign a random MAC address so the hardware can still be used. Tested as a standalone interface, as carrier for ppp, and as a bonding slave. Original-patch-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent df4511f commit 482e3fe

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎drivers/net/via-rhine.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,13 +838,15 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
838838

839839
for (i = 0; i < 6; i++)
840840
dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
841-
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
842841

843-
if (!is_valid_ether_addr(dev->perm_addr)) {
844-
rc = -EIO;
845-
dev_err(&pdev->dev, "Invalid MAC address\n");
846-
goto err_out_unmap;
842+
if (!is_valid_ether_addr(dev->dev_addr)) {
843+
/* Report it and use a random ethernet address instead */
844+
netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr);
845+
random_ether_addr(dev->dev_addr);
846+
netdev_info(dev, "Using random MAC address: %pM\n",
847+
dev->dev_addr);
847848
}
849+
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
848850

849851
/* For Rhine-I/II, phy_id is loaded from EEPROM */
850852
if (!phy_id)

0 commit comments

Comments
 (0)