[PATCH] macb: use random mac if stored address in EEPROM is invalid

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Sven Schnelle
Date: Wednesday, June 4, 2008 - 10:44 am

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>

---
 drivers/net/macb.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

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)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] macb: use random mac if stored address in EEPROM i ..., Sven Schnelle, (Wed Jun 4, 10:44 am)
Re: [PATCH] macb: use random mac if stored address in EEPR ..., Haavard Skinnemoen, (Sun Jun 8, 1:41 pm)