brcm80211: smac: Use kmemdup rather than duplicating its implementation
authorThomas Meyer <thomas@m3y3r.de>
Thu, 17 Nov 2011 22:43:40 +0000 (23:43 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 21 Nov 2011 21:20:46 +0000 (16:20 -0500)
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Acked-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c

index 6d3c7b6c5aa0dffb39acce62934967ddbb755b79..922c5d969a5b2309c2bd9b09905344699fc6db6c 100644 (file)
@@ -1549,11 +1549,10 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
                        if (le32_to_cpu(hdr->idx) == idx) {
                                pdata = wl->fw.fw_bin[i]->data +
                                        le32_to_cpu(hdr->offset);
-                               *pbuf = kmalloc(len, GFP_ATOMIC);
+                               *pbuf = kmemdup(pdata, len, GFP_ATOMIC);
                                if (*pbuf == NULL)
                                        goto fail;
 
-                               memcpy(*pbuf, pdata, len);
                                return 0;
                        }
                }