From patchwork Sat May 15 21:16:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 99881 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4FLHVZC015319 for ; Sat, 15 May 2010 21:17:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755409Ab0EOVQq (ORCPT ); Sat, 15 May 2010 17:16:46 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:41702 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755161Ab0EOVQo (ORCPT ); Sat, 15 May 2010 17:16:44 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id C04AC19BB6D; Sat, 15 May 2010 23:16:43 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07595-15; Sat, 15 May 2010 23:16:39 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 9D43819BB3C; Sat, 15 May 2010 23:16:39 +0200 (CEST) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id 23D836DFD17; Sat, 15 May 2010 23:09:28 +0200 (CEST) Received: by ask.diku.dk (Postfix, from userid 3767) id 80AB1200BE; Sat, 15 May 2010 23:16:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 763A3200BC; Sat, 15 May 2010 23:16:39 +0200 (CEST) Date: Sat, 15 May 2010 23:16:39 +0200 (CEST) From: Julia Lawall To: Luciano Coelho , "John W. Linville" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 12/37] drivers/net/wireless/wl12xx: Use kmemdup Message-ID: MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 15 May 2010 21:17:31 +0000 (UTC) diff -u -p a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c @@ -573,7 +573,7 @@ static int wl1271_fetch_nvs(struct wl127 goto out; } - wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); + wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL); if (!wl->nvs) { wl1271_error("could not allocate memory for the nvs file"); @@ -581,8 +581,6 @@ static int wl1271_fetch_nvs(struct wl127 goto out; } - memcpy(wl->nvs, fw->data, sizeof(struct wl1271_nvs_file)); - out: release_firmware(fw); @@ -2350,15 +2348,13 @@ struct ieee80211_hw *wl1271_alloc_hw(voi goto err_hw_alloc; } - plat_dev = kmalloc(sizeof(wl1271_device), GFP_KERNEL); + plat_dev = kmemdup(&wl1271_device, sizeof(wl1271_device), GFP_KERNEL); if (!plat_dev) { wl1271_error("could not allocate platform_device"); ret = -ENOMEM; goto err_plat_alloc; } - memcpy(plat_dev, &wl1271_device, sizeof(wl1271_device)); - wl = hw->priv; memset(wl, 0, sizeof(*wl));