On errors in batadv_mesh_init(), bat_counters will be freed in both batadv_mesh_free() and batadv_softif_init_late(). This patch fixes this by returning earlier from batadv_softif_init_late() in case of errors in batadv_mesh_init().
Signed-off-by: Martin Hundebøll martin@hundeboll.net --- v2: Removed label as suggested by Antonio
soft-interface.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/soft-interface.c b/soft-interface.c index c2a9c20..44089b3 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -497,12 +497,10 @@ static int batadv_softif_init_late(struct net_device *dev)
ret = batadv_mesh_init(dev); if (ret < 0) - goto unreg_debugfs; + batadv_debugfs_del_meshif(dev);
- return 0; + return ret;
-unreg_debugfs: - batadv_debugfs_del_meshif(dev); free_bat_counters: free_percpu(bat_priv->bat_counters);