drivers/net/wireless/wl12xx: Use kmemdup
[pandora-wifi.git] / drivers / net / wireless / wl12xx / wl1251_main.c
index 78f6e7f..7d8ec43 100644 (file)
@@ -126,7 +126,7 @@ static int wl1251_fetch_nvs(struct wl1251 *wl)
        }
 
        wl->nvs_len = fw->size;
-       wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL);
+       wl->nvs = kmemdup(fw->data, wl->nvs_len, GFP_KERNEL);
 
        if (!wl->nvs) {
                wl1251_error("could not allocate memory for the nvs file");
@@ -134,8 +134,6 @@ static int wl1251_fetch_nvs(struct wl1251 *wl)
                goto out;
        }
 
-       memcpy(wl->nvs, fw->data, wl->nvs_len);
-
        ret = 0;
 
 out: