]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ixp4xx_eth: Fall back to random MAC address
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 8 Jul 2022 23:55:29 +0000 (01:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 9 Jul 2022 11:34:17 +0000 (12:34 +0100)
If the firmware does not provide a MAC address to the driver,
fall back to generating a random MAC address.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xscale/ixp4xx_eth.c

index 89770c2e0ffb1bb8fc7392d664ba77ff64e19c7c..a5d1d8d120645892802bd311dcfc417de0beed50 100644 (file)
@@ -1487,7 +1487,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 
        port->plat = plat;
        npe_port_tab[NPE_ID(port->id)] = port;
-       eth_hw_addr_set(ndev, plat->hwaddr);
+       if (is_valid_ether_addr(plat->hwaddr))
+               eth_hw_addr_set(ndev, plat->hwaddr);
+       else
+               eth_hw_addr_random(ndev);
 
        platform_set_drvdata(pdev, ndev);