Commit edb9bc9a authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John W. Linville

brcmfmac: use vmalloc to allocate mem for the firmware

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: default avatarHauke Mehrtens <hauke@hauke-m.de>
Acked-by: default avatarFranky Lin <frankyl@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 885ba1da
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/vmalloc.h>
#include <net/cfg80211.h> #include <net/cfg80211.h>
#include <defs.h> #include <defs.h>
...@@ -1239,7 +1240,7 @@ static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo) ...@@ -1239,7 +1240,7 @@ static int brcmf_usb_get_fw(struct brcmf_usbdev_info *devinfo)
return -EINVAL; return -EINVAL;
} }
devinfo->image = kmalloc(fw->size, GFP_ATOMIC); /* plus nvram */ devinfo->image = vmalloc(fw->size); /* plus nvram */
if (!devinfo->image) if (!devinfo->image)
return -ENOMEM; return -ENOMEM;
...@@ -1602,7 +1603,7 @@ static struct usb_driver brcmf_usbdrvr = { ...@@ -1602,7 +1603,7 @@ static struct usb_driver brcmf_usbdrvr = {
void brcmf_usb_exit(void) void brcmf_usb_exit(void)
{ {
usb_deregister(&brcmf_usbdrvr); usb_deregister(&brcmf_usbdrvr);
kfree(g_image.data); vfree(g_image.data);
g_image.data = NULL; g_image.data = NULL;
g_image.len = 0; g_image.len = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment