Skip to contentSkip to conversation

: Consolidate hash kfree-ing in mesh.c.

PATCH In review Pavel Emelyanov 2 participants 3 messages May 7, 2008 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 7/7 : Consolidate hash kfree-ing in mesh.c.

There are already two places, that kfree the mesh_table and its buckets.

---
 net/mac80211/mesh.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
net/mac80211/mesh.c +9 -6
index f46fbdb..876ec18 100644
@@ -315,6 +315,13 @@ struct mesh_table *mesh_table_alloc(int size_order)
 	return newtbl;
 }
 
+static void __mesh_table_free(struct mesh_table *tbl)
+{
+	kfree(tbl->hash_buckets);
+	kfree(tbl->hashwlock);
+	kfree(tbl);
+}
+
 void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
 {
 	struct hlist_head *mesh_hash;
@@ -330,9 +337,7 @@ void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
 		}
 		spin_unlock(&tbl->hashwlock[i]);
 	}
-	kfree(tbl->hash_buckets);
-	kfree(tbl->hashwlock);
-	kfree(tbl);
+	__mesh_table_free(tbl);
 }
 
 static void ieee80211_mesh_path_timer(unsigned long data)
@@ -378,9 +383,7 @@ errcopy:
 		hlist_for_each_safe(p, q, &newtbl->hash_buckets[i])
 			tbl->free_node(p, 0);
 	}
-	kfree(newtbl->hash_buckets);
-	kfree(newtbl->hashwlock);
-	kfree(newtbl);
+	__mesh_table_free(tbl);
 endgrow:
 	return NULL;
 }
Signature · 1 line
1.5.3.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 14 lines · On Wednesday 07 May 2008 17:57:11 Pavel Emelyanov wrote:

There are already two places, that kfree the mesh_table and its buckets.

---
 net/mac80211/mesh.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
net/mac80211/mesh.c +0 -0
index f46fbdb..876ec18 100644

net/mac80211/mesh.c struct mesh_table *mesh_table_alloc(int size_order) · line 318

Quoted 4 lines
net/mac80211/mesh.c +1 -0
@@ -315,6 +315,13 @@ struct mesh_table *mesh_table_alloc(int size_order)
 	return newtbl;
 }
 
+static void __mesh_table_free(struct mesh_table *tbl)

Why is this __double_underscored?

Quoted 31 lines
net/mac80211/mesh.c +8 -6
+{
+	kfree(tbl->hash_buckets);
+	kfree(tbl->hashwlock);
+	kfree(tbl);
+}
+
 void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
 {
 	struct hlist_head *mesh_hash;
@@ -330,9 +337,7 @@ void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
 		}
 		spin_unlock(&tbl->hashwlock[i]);
 	}
-	kfree(tbl->hash_buckets);
-	kfree(tbl->hashwlock);
-	kfree(tbl);
+	__mesh_table_free(tbl);
 }
 
 static void ieee80211_mesh_path_timer(unsigned long data)
@@ -378,9 +383,7 @@ errcopy:
 		hlist_for_each_safe(p, q, &newtbl->hash_buckets[i])
 			tbl->free_node(p, 0);
 	}
-	kfree(newtbl->hash_buckets);
-	kfree(newtbl->hashwlock);
-	kfree(newtbl);
+	__mesh_table_free(tbl);
 endgrow:
 	return NULL;
 }
Signature · 5 lines
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 18 lines · Michael Buesch
Quoted 17 lines · On Wednesday 07 May 2008 17:57:11 Pavel Emelyanov wrote:

There are already two places, that kfree the mesh_table and its buckets.

---
 net/mac80211/mesh.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
net/mac80211/mesh.c +0 -0
index f46fbdb..876ec18 100644
@@ -315,6 +315,13 @@ struct mesh_table *mesh_table_alloc(int size_order)
 	return newtbl;
 }
 
Quoted 3 lines

net/mac80211/mesh.c struct mesh_table *mesh_table_alloc(int size_order) · line 318

Quoted 1 line
net/mac80211/mesh.c +1 -0
+static void __mesh_table_free(struct mesh_table *tbl)

Why is this __double_underscored?

To show, that this one is to be used "with care", i.e. - with all entries previously flushed.

Quoted 34 lines
Quoted 31 lines
net/mac80211/mesh.c +8 -6
+{
+	kfree(tbl->hash_buckets);
+	kfree(tbl->hashwlock);
+	kfree(tbl);
+}
+
 void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
 {
 	struct hlist_head *mesh_hash;
@@ -330,9 +337,7 @@ void mesh_table_free(struct mesh_table *tbl, bool free_leafs)
 		}
 		spin_unlock(&tbl->hashwlock[i]);
 	}
-	kfree(tbl->hash_buckets);
-	kfree(tbl->hashwlock);
-	kfree(tbl);
+	__mesh_table_free(tbl);
 }
 
 static void ieee80211_mesh_path_timer(unsigned long data)
@@ -378,9 +383,7 @@ errcopy:
 		hlist_for_each_safe(p, q, &newtbl->hash_buckets[i])
 			tbl->free_node(p, 0);
 	}
-	kfree(newtbl->hash_buckets);
-	kfree(newtbl->hashwlock);
-	kfree(newtbl);
+	__mesh_table_free(tbl);
 endgrow:
 	return NULL;
 }