aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/hard-interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/hard-interface.c')
-rw-r--r--net/batman-adv/hard-interface.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index fd9715ec6dbd..3b391fd3b5b2 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -304,22 +304,17 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
304 if (!softif_is_valid(soft_iface)) { 304 if (!softif_is_valid(soft_iface)) {
305 pr_err("Can't create batman mesh interface %s: already exists as regular interface\n", 305 pr_err("Can't create batman mesh interface %s: already exists as regular interface\n",
306 soft_iface->name); 306 soft_iface->name);
307 dev_put(soft_iface);
308 ret = -EINVAL; 307 ret = -EINVAL;
309 goto err; 308 goto err_dev;
310 } 309 }
311 310
312 hard_iface->soft_iface = soft_iface; 311 hard_iface->soft_iface = soft_iface;
313 bat_priv = netdev_priv(hard_iface->soft_iface); 312 bat_priv = netdev_priv(hard_iface->soft_iface);
314 313
315 bat_priv->bat_algo_ops->bat_iface_enable(hard_iface); 314 ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface);
316 315 if (ret < 0) {
317 if (!hard_iface->packet_buff) {
318 bat_err(hard_iface->soft_iface,
319 "Can't add interface packet (%s): out of memory\n",
320 hard_iface->net_dev->name);
321 ret = -ENOMEM; 316 ret = -ENOMEM;
322 goto err; 317 goto err_dev;
323 } 318 }
324 319
325 hard_iface->if_num = bat_priv->num_ifaces; 320 hard_iface->if_num = bat_priv->num_ifaces;
@@ -363,6 +358,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
363out: 358out:
364 return 0; 359 return 0;
365 360
361err_dev:
362 dev_put(soft_iface);
366err: 363err:
367 hardif_free_ref(hard_iface); 364 hardif_free_ref(hard_iface);
368 return ret; 365 return ret;