Commit 482e3febc2e7df78411005dcdd7621c16b98b088
Committed by
David S. Miller
1 parent
df4511feb7
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 7 additions and 5 deletions Side-by-side Diff
drivers/net/via-rhine.c
... | ... | @@ -838,13 +838,15 @@ |
838 | 838 | |
839 | 839 | for (i = 0; i < 6; i++) |
840 | 840 | dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); |
841 | - memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | |
842 | 841 | |
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); | |
847 | 848 | } |
849 | + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | |
848 | 850 | |
849 | 851 | /* For Rhine-I/II, phy_id is loaded from EEPROM */ |
850 | 852 | if (!phy_id) |