ixp4xx_eth: Fall back to random MAC address

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>
This commit is contained in:
Linus Walleij 2022-07-09 01:55:29 +02:00 committed by David S. Miller
parent 44ac441a51
commit b3ba206ce8
1 changed files with 4 additions and 1 deletions

View 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);