提交 d1d5741d 编写于 作者: S Sven Schnelle 提交者: 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: NSven Schnelle <svens@stackframe.org>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 86a74ff2
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册