linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: Remove unnecessary ksize() call
@ 2009-04-25 20:28 Michael Buesch
  2009-04-26  8:30 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Buesch @ 2009-04-25 20:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

This removes an unnecessary ksize() call. krealloc() will do this
test internally and won't perform any allocation if the space is
already sufficient to hold the data.
So remove the redundant check.

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---
 net/wireless/scan.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- wireless-testing.orig/net/wireless/scan.c
+++ wireless-testing/net/wireless/scan.c
@@ -384,11 +384,9 @@ cfg80211_bss_update(struct cfg80211_regi
 			} else {
 				u8 *ies = found->pub.information_elements;
 
-				if (found->ies_allocated) {
-					if (ksize(ies) < ielen)
-						ies = krealloc(ies, ielen,
-							       GFP_ATOMIC);
-				} else
+				if (found->ies_allocated)
+					ies = krealloc(ies, ielen, GFP_ATOMIC);
+				else
 					ies = kmalloc(ielen, GFP_ATOMIC);
 
 				if (ies) {

-- 
Greetings, Michael.

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

* Re: [PATCH] cfg80211: Remove unnecessary ksize() call
  2009-04-25 20:28 [PATCH] cfg80211: Remove unnecessary ksize() call Michael Buesch
@ 2009-04-26  8:30 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2009-04-26  8:30 UTC (permalink / raw)
  To: Michael Buesch; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

On Sat, 2009-04-25 at 22:28 +0200, Michael Buesch wrote:
> This removes an unnecessary ksize() call. krealloc() will do this
> test internally and won't perform any allocation if the space is
> already sufficient to hold the data.
> So remove the redundant check.
> 
> Signed-off-by: Michael Buesch <mb@bu3sch.de>

Good catch, thanks.

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

johannes

> ---
>  net/wireless/scan.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> --- wireless-testing.orig/net/wireless/scan.c
> +++ wireless-testing/net/wireless/scan.c
> @@ -384,11 +384,9 @@ cfg80211_bss_update(struct cfg80211_regi
>  			} else {
>  				u8 *ies = found->pub.information_elements;
>  
> -				if (found->ies_allocated) {
> -					if (ksize(ies) < ielen)
> -						ies = krealloc(ies, ielen,
> -							       GFP_ATOMIC);
> -				} else
> +				if (found->ies_allocated)
> +					ies = krealloc(ies, ielen, GFP_ATOMIC);
> +				else
>  					ies = kmalloc(ielen, GFP_ATOMIC);
>  
>  				if (ies) {
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2009-04-26  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-25 20:28 [PATCH] cfg80211: Remove unnecessary ksize() call Michael Buesch
2009-04-26  8:30 ` Johannes Berg

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).