Skip to content

Commit

Permalink
macb: use random mac if stored address in EEPROM is invalid
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Haavard Skinnemoen <[email protected]>
Cc: Jeff Garzik <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
  • Loading branch information
svenschnelle authored and Jeff Garzik committed Jun 12, 2008
1 parent 86a74ff commit d1d5741
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d1d5741

Please sign in to comment.