DM9000: Allow randomised ethernet address
authorBen Dooks <ben-linux@fluff.org>
Thu, 24 Feb 2011 03:17:12 +0000 (03:17 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Feb 2011 20:42:17 +0000 (12:42 -0800)
Allow randomised ethernet address if the device does not have a valid
EEPROM or pre-set MAC address.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dm9000.c

index 2d4c4fc1d90053fa6c04785eac027ef0a59d424c..c30935587207a56ce74973c092791a0498b6bdee 100644 (file)
@@ -1592,10 +1592,15 @@ dm9000_probe(struct platform_device *pdev)
                        ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
        }
 
-       if (!is_valid_ether_addr(ndev->dev_addr))
+       if (!is_valid_ether_addr(ndev->dev_addr)) {
                dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please "
                         "set using ifconfig\n", ndev->name);
 
+               random_ether_addr(ndev->dev_addr);
+               mac_src = "random";
+       }
+
+
        platform_set_drvdata(pdev, ndev);
        ret = register_netdev(ndev);