summaryrefslogtreecommitdiff
path: root/net/hsr/hsr_device.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-07-11 10:46:00 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-11 10:46:00 +0300
commit71930d61025e7d0254f3c682cb1b5242e0499cf3 (patch)
tree43b642f15d33ae6ba08a31ddf2d50e2915868a5e /net/hsr/hsr_device.c
parenta594920f8747fa032c784c3660d6cd5a8ab291f8 (diff)
parent1df0d8960499e58963fd6c8ac75e544f2b417b29 (diff)
downloadlinux-71930d61025e7d0254f3c682cb1b5242e0499cf3.tar.xz
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
All conflicts seemed rather trivial, with some guidance from Saeed Mameed on the tc_ct.c one. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/hsr/hsr_device.c')
-rw-r--r--net/hsr/hsr_device.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 1032b83d7047..8a927b647829 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;
}