Commit 9213bb83 authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

wimax/i2400m: use is_zero_ether_addr() instead of memcmp()

Using is_zero_ether_addr() instead of directly use
memcmp() to determine if the ethernet address is all
zeros.

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 8f4cccbb
...@@ -222,7 +222,6 @@ int i2400m_check_mac_addr(struct i2400m *i2400m) ...@@ -222,7 +222,6 @@ int i2400m_check_mac_addr(struct i2400m *i2400m)
struct sk_buff *skb; struct sk_buff *skb;
const struct i2400m_tlv_detailed_device_info *ddi; const struct i2400m_tlv_detailed_device_info *ddi;
struct net_device *net_dev = i2400m->wimax_dev.net_dev; struct net_device *net_dev = i2400m->wimax_dev.net_dev;
const unsigned char zeromac[ETH_ALEN] = { 0 };
d_fnstart(3, dev, "(i2400m %p)\n", i2400m); d_fnstart(3, dev, "(i2400m %p)\n", i2400m);
skb = i2400m_get_device_info(i2400m); skb = i2400m_get_device_info(i2400m);
...@@ -244,7 +243,7 @@ int i2400m_check_mac_addr(struct i2400m *i2400m) ...@@ -244,7 +243,7 @@ int i2400m_check_mac_addr(struct i2400m *i2400m)
"to that of boot mode's\n"); "to that of boot mode's\n");
dev_warn(dev, "device reports %pM\n", ddi->mac_address); dev_warn(dev, "device reports %pM\n", ddi->mac_address);
dev_warn(dev, "boot mode reported %pM\n", net_dev->perm_addr); dev_warn(dev, "boot mode reported %pM\n", net_dev->perm_addr);
if (!memcmp(zeromac, ddi->mac_address, sizeof(zeromac))) if (is_zero_ether_addr(ddi->mac_address))
dev_err(dev, "device reports an invalid MAC address, " dev_err(dev, "device reports an invalid MAC address, "
"not updating\n"); "not updating\n");
else { else {
......
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