Commit d1d5741d authored by Sven Schnelle's avatar Sven Schnelle Committed by Jeff Garzik

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: default avatarSven Schnelle <svens@stackframe.org>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 86a74ff2
...@@ -80,8 +80,12 @@ static void __init macb_get_hwaddr(struct macb *bp) ...@@ -80,8 +80,12 @@ static void __init macb_get_hwaddr(struct macb *bp)
addr[4] = top & 0xff; addr[4] = top & 0xff;
addr[5] = (top >> 8) & 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)); 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) static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment