From: Joe Perches Date: Sat, 16 Apr 2011 14:15:26 +0000 (+0000) Subject: via-rhine: Assign random MAC address if necessary X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=482e3febc2e7df78411005dcdd7621c16b98b088;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 40f394ce113b..7f23ab913fd9 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c @@ -838,13 +838,15 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, for (i = 0; i < 6; i++) dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i); - memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); - if (!is_valid_ether_addr(dev->perm_addr)) { - rc = -EIO; - dev_err(&pdev->dev, "Invalid MAC address\n"); - goto err_out_unmap; + if (!is_valid_ether_addr(dev->dev_addr)) { + /* Report it and use a random ethernet address instead */ + netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr); + random_ether_addr(dev->dev_addr); + netdev_info(dev, "Using random MAC address: %pM\n", + dev->dev_addr); } + memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); /* For Rhine-I/II, phy_id is loaded from EEPROM */ if (!phy_id)