]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
macb: use random mac if stored address in EEPROM is invalid
authorSven Schnelle <svens@stackframe.org>
Mon, 9 Jun 2008 23:33:57 +0000 (16:33 -0700)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 12 Jun 2008 01:58:28 +0000 (21:58 -0400)
We should use a random mac address if the EEPROM doesn't contain a valid
one. This makes life on Boards with unprogrammed EEPROM devices easier.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/macb.c

index 92dccd43bdcab39fbd0bcd374d3447a33961443c..e34630252cefcfa5216e08c3658d1f4ad9447c4c 100644 (file)
@@ -80,8 +80,12 @@ static void __init macb_get_hwaddr(struct macb *bp)
        addr[4] = top & 0xff;
        addr[5] = (top >> 8) & 0xff;
 
-       if (is_valid_ether_addr(addr))
+       if (is_valid_ether_addr(addr)) {
                memcpy(bp->dev->dev_addr, addr, sizeof(addr));
+       } else {
+               dev_info(&bp->pdev->dev, "invalid hw address, using random\n");
+               random_ether_addr(bp->dev->dev_addr);
+       }
 }
 
 static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)