netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/7][MAC80211]: Consolidate hash kfree-ing in mesh.c.
@ 2008-05-07 15:57 Pavel Emelyanov
       [not found] ` <4821D157.90403-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2008-05-07 15:57 UTC (permalink / raw)
  To: Johannes Berg, John W. Linville; +Cc: linux-wireless, Linux Netdev List

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

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---
 net/mac80211/mesh.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index f46fbdb..876ec18 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -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;
 }
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 7/7][MAC80211]: Consolidate hash kfree-ing in mesh.c.
       [not found] ` <4821D157.90403-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2008-05-07 16:03   ` Michael Buesch
  2008-05-07 16:24     ` Pavel Emelyanov
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Buesch @ 2008-05-07 16:03 UTC (permalink / raw)
  To: Pavel Emelyanov
  Cc: Johannes Berg, John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Linux Netdev List

On Wednesday 07 May 2008 17:57:11 Pavel Emelyanov wrote:
> There are already two places, that kfree the mesh_table and
> its buckets.
> 
> Signed-off-by: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
> 
> ---
>  net/mac80211/mesh.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
> index f46fbdb..876ec18 100644
> --- a/net/mac80211/mesh.c
> +++ b/net/mac80211/mesh.c
> @@ -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?

> +{
> +	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;
>  }



-- 
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 7/7][MAC80211]: Consolidate hash kfree-ing in mesh.c.
  2008-05-07 16:03   ` Michael Buesch
@ 2008-05-07 16:24     ` Pavel Emelyanov
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Emelyanov @ 2008-05-07 16:24 UTC (permalink / raw)
  To: Michael Buesch
  Cc: Johannes Berg, John W. Linville, linux-wireless,
	Linux Netdev List

Michael Buesch wrote:
> On Wednesday 07 May 2008 17:57:11 Pavel Emelyanov wrote:
>> There are already two places, that kfree the mesh_table and
>> its buckets.
>>
>> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
>>
>> ---
>>  net/mac80211/mesh.c |   15 +++++++++------
>>  1 files changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
>> index f46fbdb..876ec18 100644
>> --- a/net/mac80211/mesh.c
>> +++ b/net/mac80211/mesh.c
>> @@ -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?

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

>> +{
>> +	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;
>>  }
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-07 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07 15:57 [PATCH 7/7][MAC80211]: Consolidate hash kfree-ing in mesh.c Pavel Emelyanov
     [not found] ` <4821D157.90403-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2008-05-07 16:03   ` Michael Buesch
2008-05-07 16:24     ` Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).