diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-07-22 10:22:02 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-07-22 10:22:02 +0200 |
commit | 015dc08918785201199ed3450c22bb8939f09dfe (patch) | |
tree | 7ba52e0b1e518fa750aaac0c1da8dd70c3eca1eb /net/hsr/hsr_device.c | |
parent | sched: Add a tracepoint to track rq->nr_running (diff) | |
parent | sched: Fix race against ptrace_freeze_trace() (diff) | |
download | linux-015dc08918785201199ed3450c22bb8939f09dfe.tar.xz linux-015dc08918785201199ed3450c22bb8939f09dfe.zip |
Merge branch 'sched/urgent'
Diffstat (limited to 'net/hsr/hsr_device.c')
-rw-r--r-- | net/hsr/hsr_device.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 478852ef98ef..a6f4e9f65b14 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -415,6 +415,7 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], unsigned char multicast_spec, u8 protocol_version, struct netlink_ext_ack *extack) { + bool unregister = false; struct hsr_priv *hsr; int res; @@ -466,25 +467,27 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], if (res) goto err_unregister; + unregister = true; + res = hsr_add_port(hsr, slave[0], HSR_PT_SLAVE_A, extack); if (res) - goto err_add_slaves; + goto err_unregister; res = hsr_add_port(hsr, slave[1], HSR_PT_SLAVE_B, extack); if (res) - goto err_add_slaves; + goto err_unregister; hsr_debugfs_init(hsr, hsr_dev); mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD)); return 0; -err_add_slaves: - unregister_netdevice(hsr_dev); err_unregister: hsr_del_ports(hsr); err_add_master: hsr_del_self_node(hsr); + if (unregister) + unregister_netdevice(hsr_dev); return res; } |