Skip to content

Commit

Permalink
net: bareudp: simplify error paths calling dellink
Browse files Browse the repository at this point in the history
bareudp_dellink() only needs the device list to hand it to
unregister_netdevice_queue(). We can pass NULL in, and
unregister_netdevice_queue() will do the unregistering.
There is no chance for batching on the error path, anyway.

Suggested-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Link: https://lore.kernel.org/r/20210111052922.2145003-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jan 12, 2021
1 parent 101c59b commit 1d04ccb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/net/bareudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,6 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
struct netlink_ext_ack *extack)
{
struct bareudp_conf conf;
LIST_HEAD(list_kill);
int err;

err = bareudp2info(data, &conf, extack);
Expand All @@ -676,8 +675,7 @@ static int bareudp_newlink(struct net *net, struct net_device *dev,
return 0;

err_unconfig:
bareudp_dellink(dev, &list_kill);
unregister_netdevice_many(&list_kill);
bareudp_dellink(dev, NULL);
return err;
}

Expand Down Expand Up @@ -729,7 +727,6 @@ struct net_device *bareudp_dev_create(struct net *net, const char *name,
{
struct nlattr *tb[IFLA_MAX + 1];
struct net_device *dev;
LIST_HEAD(list_kill);
int err;

memset(tb, 0, sizeof(tb));
Expand All @@ -753,8 +750,7 @@ struct net_device *bareudp_dev_create(struct net *net, const char *name,

return dev;
err:
bareudp_dellink(dev, &list_kill);
unregister_netdevice_many(&list_kill);
bareudp_dellink(dev, NULL);
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(bareudp_dev_create);
Expand Down

0 comments on commit 1d04ccb

Please sign in to comment.