linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: use vmalloc to allocate mem for the firmware
@ 2012-05-18 18:22 Hauke Mehrtens
  2012-05-18 18:33 ` Franky Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Hauke Mehrtens @ 2012-05-18 18:22 UTC (permalink / raw)
  To: linville, frankyl; +Cc: linux-wireless, Hauke Mehrtens

The firmware is more than 300KB big and you should not use kmalloc for
such big allocations. This allocation with kmalloc failed on my mips
based device (BCM47186).

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmfmac/usb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index 1d67ecf..3e35247 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -28,6 +28,7 @@
 #include <linux/uaccess.h>
 #include <linux/firmware.h>
 #include <linux/usb.h>
+#include <linux/vmalloc.h>
 #include <net/cfg80211.h>
 
 #include <defs.h>
@@ -1239,7 +1240,7 @@ static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo)
 		return -EINVAL;
 	}
 
-	devinfo->image = kmalloc(fw->size, GFP_ATOMIC); /* plus nvram */
+	devinfo->image = vmalloc(fw->size); /* plus nvram */
 	if (!devinfo->image)
 		return -ENOMEM;
 
@@ -1602,7 +1603,7 @@ static struct usb_driver brcmf_usbdrvr = {
 void brcmf_usb_exit(void)
 {
 	usb_deregister(&brcmf_usbdrvr);
-	kfree(g_image.data);
+	vfree(g_image.data);
 	g_image.data = NULL;
 	g_image.len = 0;
 }
-- 
1.7.9.5


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

* Re: [PATCH] brcmfmac: use vmalloc to allocate mem for the firmware
  2012-05-18 18:22 [PATCH] brcmfmac: use vmalloc to allocate mem for the firmware Hauke Mehrtens
@ 2012-05-18 18:33 ` Franky Lin
  0 siblings, 0 replies; 2+ messages in thread
From: Franky Lin @ 2012-05-18 18:33 UTC (permalink / raw)
  To: Hauke Mehrtens, linville; +Cc: linux-wireless

On 05/18/2012 11:22 AM, Hauke Mehrtens wrote:
> The firmware is more than 300KB big and you should not use kmalloc for
> such big allocations. This allocation with kmalloc failed on my mips
> based device (BCM47186).
>
> Signed-off-by: Hauke Mehrtens<hauke@hauke-m.de>
> ---

You're right. We have noticed the kmalloc usage probelm but didn't have 
time to clean up the mess. Thanks for fixing this one.

Acked-by: Franky Lin <frankyl@broadcom.com>

Franky


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

end of thread, other threads:[~2012-05-18 18:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-18 18:22 [PATCH] brcmfmac: use vmalloc to allocate mem for the firmware Hauke Mehrtens
2012-05-18 18:33 ` Franky Lin

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