Commit 6c3efbe7 authored by Takashi Iwai's avatar Takashi Iwai Committed by Kalle Valo

brcmsmac: Use kvmalloc() for ucode allocations

The ucode chunk might be relatively large and the allocation with
kmalloc() may fail occasionally.  Since the data isn't DMA-transferred
but by manual loops, we can use vmalloc instead of kmalloc.
For a better performance, though, kvmalloc() would be the best choice
in such a case, so let's replace with it.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1103431Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent a8254fa4
...@@ -1578,10 +1578,10 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx) ...@@ -1578,10 +1578,10 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
if (le32_to_cpu(hdr->idx) == idx) { if (le32_to_cpu(hdr->idx) == idx) {
pdata = wl->fw.fw_bin[i]->data + pdata = wl->fw.fw_bin[i]->data +
le32_to_cpu(hdr->offset); le32_to_cpu(hdr->offset);
*pbuf = kmemdup(pdata, len, GFP_KERNEL); *pbuf = kvmalloc(len, GFP_KERNEL);
if (*pbuf == NULL) if (*pbuf == NULL)
goto fail; goto fail;
memcpy(*pbuf, pdata, len);
return 0; return 0;
} }
} }
...@@ -1629,7 +1629,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx) ...@@ -1629,7 +1629,7 @@ int brcms_ucode_init_uint(struct brcms_info *wl, size_t *n_bytes, u32 idx)
*/ */
void brcms_ucode_free_buf(void *p) void brcms_ucode_free_buf(void *p)
{ {
kfree(p); kvfree(p);
} }
/* /*
......
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