From: Sven Schnelle Date: Mon, 9 Jun 2008 23:33:57 +0000 (-0700) Subject: macb: use random mac if stored address in EEPROM is invalid X-Git-Tag: v3.12-rc1~19957^2~329^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1d5741d8568c268ec234a5b35af4a04498be6d8;p=kernel%2Fkernel-generic.git macb: use random mac if stored address in EEPROM is invalid 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 Cc: Haavard Skinnemoen Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 92dccd4..e346302 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -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)