diff mbox

via-rhine: do not abort due to invalid MAC address

Message ID 4D700D66.5090300@gmail.com
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Alex G. March 3, 2011, 9:51 p.m. UTC

Comments

David Miller March 3, 2011, 10:01 p.m. UTC | #1
Still wrong, the patch needs to be "-p1" not "-p0" rooted.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

via-rhine drops out of the init code if the hardware provides an invalid
MAC address. Roger Luethi has had several reports of Rhine NICs doing just
that. The hardware still works, though; assigning a random MAC address
allows the NIC to be used as usual. Tested as a standalone interface,
as carrier for ppp, and as bonding slave.

Signed-off-by Alexandru Gagniuc <mr.nuke.me@gmail.com>

--- drivers/net/via-rhine.c.orig	2011-02-06 21:04:07.000000000 +0200
+++ drivers/net/via-rhine.c	2011-03-02 22:03:13.000000000 +0200
@@ -762,13 +762,16 @@  static int __devinit rhine_init_one(stru
 
 	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;
-		printk(KERN_ERR "Invalid MAC address\n");
-		goto err_out_unmap;
+	if (!is_valid_ether_addr(dev->dev_addr)) {
+		printk(KERN_ERR "via-rhine: Invalid MAC address: %pM. \n",
+				dev->dev_addr);
+		/* The device may still be used normally if a valid MAC is configured */
+		random_ether_addr(dev->dev_addr);
+		printk(KERN_ERR "via-rhine: Using randomly generated address: %pM instead. \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)