From: Sergei Shtylyov Date: Mon, 29 Apr 2013 09:49:42 +0000 (+0000) Subject: sh_eth: use random MAC address if no valid one supplied X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ff6e722870ddca2808b5d46159e58904f8ededf1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git sh_eth: use random MAC address if no valid one supplied On Renesas R-Car based development boards, although a MAC address is printed on all the Ethernet port labels, U-Boot doesn't write a valid MAC address to the Ether MAHR/MALR registers (there's no storage provided for the Ether MAC address either), so we have to resort to using a random MAC address... Signed-off-by: Sergei Shtylyov Acked-by: Laurent Pinchart Acked-by: Simon Horman Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index e46da1e8f98e..33dc6f2418f2 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2735,6 +2735,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) /* read and set MAC address */ read_mac_address(ndev, pd->mac_addr); + if (!is_valid_ether_addr(ndev->dev_addr)) { + dev_warn(&pdev->dev, + "no valid MAC address supplied, using a random one.\n"); + eth_hw_addr_random(ndev); + } /* ioremap the TSU registers */ if (mdp->cd->tsu) {