Commit 1f7c9ae7 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

w5300: using eth_hw_addr_random() for random MAC and set device flag

Using eth_hw_addr_random() to generate a random Ethernet address
(MAC) to be used by a net device and set addr_assign_type.
Not need to duplicating its implementation.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d68bb7e1
...@@ -557,8 +557,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev) ...@@ -557,8 +557,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)
if (data && is_valid_ether_addr(data->mac_addr)) { if (data && is_valid_ether_addr(data->mac_addr)) {
memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN); memcpy(ndev->dev_addr, data->mac_addr, ETH_ALEN);
} else { } else {
eth_random_addr(ndev->dev_addr); eth_hw_addr_random(ndev);
ndev->addr_assign_type |= NET_ADDR_RANDOM;
} }
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment