Commit f25c80a4b2bf93c99820f470573626557db35202
Committed by
David S. Miller
1 parent
df1086fb2e
Exists in
master
and in
4 other branches
arch/um/drivers: remove duplicate structure field initialization
There are two initializations of ndo_set_mac_address, one to a local function that is not used otherwise and one to a function that is defined elsewhere. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ identifier I, s, fld; position p0,p; expression E; @@ struct I s =@p0 { ... .fld@p = E, ...}; @s@ identifier I, s, r.fld; position r.p0,p; expression E; @@ struct I s =@p0 { ... .fld@p = E, ...}; @script:python@ p0 << r.p0; fld << r.fld; ps << s.p; pr << r.p; @@ if int(ps[0].line)<int(pr[0].line) or int(ps[0].column)<int(pr[0].column): cocci.print_main(fld,p0) // </smpl> akpm: - Use the standard eth_mac_addr() in uml_net_set_mac() - Remove unneeded and racy local set_ether_mac() - Remove duplicated (and incorrect) uml_netdev_ops.ndo_set_mac_address initializer. Fixes 8bb95b39a16ed55226810596f92216c53329d2fe ("uml: convert network device to netdevice ops"). [akpm@linux-foundation.org: rework as above] Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 2 additions and 8 deletions Side-by-side Diff
arch/um/drivers/net_kern.c
... | ... | @@ -25,11 +25,6 @@ |
25 | 25 | #include "net_kern.h" |
26 | 26 | #include "net_user.h" |
27 | 27 | |
28 | -static inline void set_ether_mac(struct net_device *dev, unsigned char *addr) | |
29 | -{ | |
30 | - memcpy(dev->dev_addr, addr, ETH_ALEN); | |
31 | -} | |
32 | - | |
33 | 28 | #define DRIVER_NAME "uml-netdev" |
34 | 29 | |
35 | 30 | static DEFINE_SPINLOCK(opened_lock); |
... | ... | @@ -266,7 +261,7 @@ |
266 | 261 | struct sockaddr *hwaddr = addr; |
267 | 262 | |
268 | 263 | spin_lock_irq(&lp->lock); |
269 | - set_ether_mac(dev, hwaddr->sa_data); | |
264 | + eth_mac_addr(dev, hwaddr->sa_data); | |
270 | 265 | spin_unlock_irq(&lp->lock); |
271 | 266 | |
272 | 267 | return 0; |
... | ... | @@ -380,7 +375,6 @@ |
380 | 375 | .ndo_tx_timeout = uml_net_tx_timeout, |
381 | 376 | .ndo_set_mac_address = uml_net_set_mac, |
382 | 377 | .ndo_change_mtu = uml_net_change_mtu, |
383 | - .ndo_set_mac_address = eth_mac_addr, | |
384 | 378 | .ndo_validate_addr = eth_validate_addr, |
385 | 379 | }; |
386 | 380 | |
... | ... | @@ -478,7 +472,7 @@ |
478 | 472 | ((*transport->user->init)(&lp->user, dev) != 0)) |
479 | 473 | goto out_unregister; |
480 | 474 | |
481 | - set_ether_mac(dev, device->mac); | |
475 | + eth_mac_addr(dev, device->mac); | |
482 | 476 | dev->mtu = transport->user->mtu; |
483 | 477 | dev->netdev_ops = ¨_netdev_ops; |
484 | 478 | dev->ethtool_ops = ¨_net_ethtool_ops; |