From 99470819b1a89f77c1eb44f6b3328c1aeb2c87d0 Mon Sep 17 00:00:00 2001 From: Luka Perkov Date: Wed, 30 Oct 2013 00:11:00 +0100 Subject: arc_emac: drop redundant mac address check Checking if MAC address is valid using is_valid_ether_addr() is already done in of_get_mac_address(). While at it, reorganize checking so it matches checks in other drivers. Signed-off-by: Luka Perkov CC: Alexey Brodkin CC: David Miller Signed-off-by: David S. Miller --- drivers/net/ethernet/arc/emac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/net/ethernet/arc/emac_main.c') diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index 9e1601487263..d818ded6c05c 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c @@ -725,10 +725,10 @@ static int arc_emac_probe(struct platform_device *pdev) /* Get MAC address from device tree */ mac_addr = of_get_mac_address(pdev->dev.of_node); - if (!mac_addr || !is_valid_ether_addr(mac_addr)) - eth_hw_addr_random(ndev); - else + if (mac_addr) memcpy(ndev->dev_addr, mac_addr, ETH_ALEN); + else + eth_hw_addr_random(ndev); dev_info(&pdev->dev, "MAC address is now %pM\n", ndev->dev_addr); -- cgit v1.2.3 From 45f1b02728438dc3c74a08a90f6ad8f60cbb1c6d Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Mon, 11 Nov 2013 14:15:12 +0800 Subject: ethernet/arc/arc_emac: add missing platform_set_drvdata() in arc_emac_probe() Add missing platform_set_drvdata() in arc_emac_probe(), otherwise calling platform_get_drvdata() in arc_emac_remove() may returns NULL. Signed-off-by: Wei Yongjun Signed-off-by: David S. Miller --- drivers/net/ethernet/arc/emac_main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/ethernet/arc/emac_main.c') diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index d818ded6c05c..473c37786700 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c @@ -671,6 +671,7 @@ static int arc_emac_probe(struct platform_device *pdev) if (!ndev) return -ENOMEM; + platform_set_drvdata(pdev, ndev); SET_NETDEV_DEV(ndev, &pdev->dev); ndev->netdev_ops = &arc_emac_netdev_ops; -- cgit v1.2.3