aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/macb.c
diff options
context:
space:
mode:
authorSven Schnelle <svens@stackframe.org>2008-06-09 19:33:57 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-06-11 21:58:28 -0400
commitd1d5741d8568c268ec234a5b35af4a04498be6d8 (patch)
treecda12027b3afb215d085229a86a40584f3637450 /drivers/net/macb.c
parent86a74ff21a7ac4bc06b18076ddb0347712b46cfd (diff)
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 <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>
Diffstat (limited to 'drivers/net/macb.c')
-rw-r--r--drivers/net/macb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 92dccd43bdca..e34630252cef 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -80,8 +80,12 @@ static void __init macb_get_hwaddr(struct macb *bp)
80 addr[4] = top & 0xff; 80 addr[4] = top & 0xff;
81 addr[5] = (top >> 8) & 0xff; 81 addr[5] = (top >> 8) & 0xff;
82 82
83 if (is_valid_ether_addr(addr)) 83 if (is_valid_ether_addr(addr)) {
84 memcpy(bp->dev->dev_addr, addr, sizeof(addr)); 84 memcpy(bp->dev->dev_addr, addr, sizeof(addr));
85 } else {
86 dev_info(&bp->pdev->dev, "invalid hw address, using random\n");
87 random_ether_addr(bp->dev->dev_addr);
88 }
85} 89}
86 90
87static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum) 91static int macb_mdio_read(struct mii_bus *bus, int mii_id, int regnum)