Message ID | 20230113141231.71892-1-sensor1010@163.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp294598wrt; Fri, 13 Jan 2023 06:19:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXvLk3bP0gcxfyS0aep9Q+OTfgF+jEve9Fv9kE1iNL+UBTeTIRUaXIDO7bBH4+YPOaI9KwYt X-Received: by 2002:a17:906:85d5:b0:7c1:7c3a:ffba with SMTP id i21-20020a17090685d500b007c17c3affbamr3149519ejy.35.1673619542713; Fri, 13 Jan 2023 06:19:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673619542; cv=none; d=google.com; s=arc-20160816; b=XYJDAz6xfXLQiAjbZb/yjIqjIK4OdfTX4pQYRRItajmmtFN93/Y0KfAvh63cfc+PMh fccXQ55T6trXv9anXuCZjmaA76L74J8ZpXE4KPzg35cFha7hf/2qg1B8V8UodMZBU1Ex a7rRc4DHJLmp1hwQBFIb7iLwJuw/W6xlHgW5ObJlqebkT0CpWWPucF+ej0gUxeilFzoS DM3FLZ5P0E51X+XWriVicmbS53Rdpm/oZWIv72ke5f/dSvvVvYxHMZo0riMXaBd/KE5c UH9jWW1X7l+V+X0ZnWXhgun/FBPF7xWJEKY1XYuQDJB0ML79lASiTrPzQ7SmP5Rbnq/i lUZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=xF0ls5Fi+t7xMM14q4HXHz7GOP+iE/4qyk2/iOPLNhE=; b=IjMi3G4kW0Fp1Xaeebg8E/7uler9iylA0+YXWn3tYsV93qZejeq5BOcYO2dfBSZ6dc evI+H1iBMFHdwVd/0elAlWs0dVDVDGeKzi6J+R1bldeWmPvkl1Kk3+KvCL/U1evELMk/ g4qW+HUZhJCplvVcAD0MbXcMzQsU2bXLnFT8CNY1AI8TRy12MFK/gMRlbyBOTWsSS3P7 WvPWyS9c9NtG4ZUPxpE4G9gE3lnzxyL8CcpGRdv7ylSODbZKOc9qDCs4EllGoYC/aPnF eIrtxFXkzMgAib/bXJuuiI1MGYi0vTB6+dln/dZAPYZqRDjmknb8YtHda/tjbors8dUj Y1wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=lD4nCcmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020a05640234d600b0046b953601cbsi24604848edc.27.2023.01.13.06.18.32; Fri, 13 Jan 2023 06:19:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=lD4nCcmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233221AbjAMOR2 (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Fri, 13 Jan 2023 09:17:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232417AbjAMOPW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Jan 2023 09:15:22 -0500 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.214]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4907D5E0AB; Fri, 13 Jan 2023 06:14:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=xF0ls5Fi+t7xMM14q4 HXHz7GOP+iE/4qyk2/iOPLNhE=; b=lD4nCcmgoA1/p/399zKEXQ77X++jXrL1w0 L1PE011hyDddhSAKnz2SPaW4DkVMzYX3hv5Kxdd4a4yZLZVoMPfV75XpMu8Iy5UZ K1g6/SLFGYnId80dXoKGdmn4xp63UPJWZNvMT9JltvXVmwprb3kWs0WrYsVkge9z vYYCSIQbM= Received: from localhost.localdomain (unknown [114.107.204.148]) by zwqz-smtp-mta-g4-3 (Coremail) with SMTP id _____wCnAMbRZsFjEoX7AA--.30424S4; Fri, 13 Jan 2023 22:13:01 +0800 (CST) From: Lizhe <sensor1010@163.com> To: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, johannes.berg@intel.com, alexander@wetzel-home.de Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lizhe <sensor1010@163.com> Subject: [PATCH v1] wireless/at76c50x-usb.c : Use devm_kmalloc replaces kmalloc Date: Fri, 13 Jan 2023 06:12:31 -0800 Message-Id: <20230113141231.71892-1-sensor1010@163.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: _____wCnAMbRZsFjEoX7AA--.30424S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrKw1fGF15XF4rWr1fuFyUZFb_yoWfZFc_CF 4xWrn7JFWUJFs2gry7CrW7ZFySkF1xXF4xua13Kay3Xw12vrWUZrWkZF9xZFZrurWfAFy3 Ar1DtFy5ZayvgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRWE_NPUUUUU== X-Originating-IP: [114.107.204.148] X-CM-SenderInfo: 5vhq20jurqiii6rwjhhfrp/1tbiKA-1q17WLz+AlgAAs3 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754917285791012659?= X-GMAIL-MSGID: =?utf-8?q?1754917285791012659?= |
Series |
[v1] wireless/at76c50x-usb.c : Use devm_kmalloc replaces kmalloc
|
|
Commit Message
Lizhe
Jan. 13, 2023, 2:12 p.m. UTC
use devm_kmalloc replaces kmalloc
Signed-off-by: Lizhe <sensor1010@163.com>
---
drivers/net/wireless/atmel/at76c50x-usb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Comments
Hi Lizhe, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on wireless-next/main] [also build test WARNING on wireless/main net-next/master net/master linus/master v6.2-rc3 next-20230113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Lizhe/wireless-at76c50x-usb-c-Use-devm_kmalloc-replaces-kmalloc/20230113-221810 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230113141231.71892-1-sensor1010%40163.com patch subject: [PATCH v1] wireless/at76c50x-usb.c : Use devm_kmalloc replaces kmalloc config: ia64-allyesconfig compiler: ia64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/0014c43a8d5f050965cc8fd562a8f0c21952f64b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Lizhe/wireless-at76c50x-usb-c-Use-devm_kmalloc-replaces-kmalloc/20230113-221810 git checkout 0014c43a8d5f050965cc8fd562a8f0c21952f64b # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/net/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/net/wireless/atmel/at76c50x-usb.c: In function 'at76_probe': >> drivers/net/wireless/atmel/at76c50x-usb.c:2447:28: warning: passing argument 1 of 'devm_kmalloc' makes pointer from integer without a cast [-Wint-conversion] 2447 | fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); | ^~~~~~~~~~~~ | | | long unsigned int In file included from include/linux/usb.h:19, from drivers/net/wireless/atmel/at76c50x-usb.c:31: include/linux/device.h:200:35: note: expected 'struct device *' but argument is of type 'long unsigned int' 200 | void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; | ~~~~~~~~~~~~~~~^~~ drivers/net/wireless/atmel/at76c50x-usb.c:2447:15: error: too few arguments to function 'devm_kmalloc' 2447 | fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); | ^~~~~~~~~~~~ include/linux/device.h:200:7: note: declared here 200 | void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; | ^~~~~~~~~~~~ vim +/devm_kmalloc +2447 drivers/net/wireless/atmel/at76c50x-usb.c 2432 2433 static int at76_probe(struct usb_interface *interface, 2434 const struct usb_device_id *id) 2435 { 2436 int ret; 2437 struct at76_priv *priv; 2438 struct fwentry *fwe; 2439 struct usb_device *udev; 2440 int op_mode; 2441 int need_ext_fw = 0; 2442 struct mib_fw_version *fwv = NULL; 2443 int board_type = (int)id->driver_info; 2444 2445 udev = usb_get_dev(interface_to_usbdev(interface)); 2446 > 2447 fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); 2448 if (!fwv) { 2449 ret = -ENOMEM; 2450 goto exit; 2451 } 2452 2453 /* Load firmware into kernel memory */ 2454 fwe = at76_load_firmware(udev, board_type); 2455 if (!fwe) { 2456 ret = -ENOENT; 2457 goto exit; 2458 } 2459 2460 op_mode = at76_get_op_mode(udev); 2461 2462 at76_dbg(DBG_DEVSTART, "opmode %d", op_mode); 2463 2464 /* we get OPMODE_NONE with 2.4.23, SMC2662W-AR ??? 2465 we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */ 2466 2467 if (op_mode == OPMODE_HW_CONFIG_MODE) { 2468 dev_err(&interface->dev, 2469 "cannot handle a device in HW_CONFIG_MODE\n"); 2470 ret = -EBUSY; 2471 goto exit; 2472 } 2473 2474 if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH 2475 && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) { 2476 /* download internal firmware part */ 2477 dev_printk(KERN_DEBUG, &interface->dev, 2478 "downloading internal firmware\n"); 2479 ret = at76_load_internal_fw(udev, fwe); 2480 if (ret < 0) { 2481 dev_err(&interface->dev, 2482 "error %d downloading internal firmware\n", 2483 ret); 2484 } 2485 goto exit; 2486 } 2487 2488 /* Internal firmware already inside the device. Get firmware 2489 * version to test if external firmware is loaded. 2490 * This works only for newer firmware, e.g. the Intersil 0.90.x 2491 * says "control timeout on ep0in" and subsequent 2492 * at76_get_op_mode() fail too :-( */ 2493 2494 /* if version >= 0.100.x.y or device with built-in flash we can 2495 * query the device for the fw version */ 2496 if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100) 2497 || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { 2498 ret = at76_get_mib(udev, MIB_FW_VERSION, fwv, sizeof(*fwv)); 2499 if (ret < 0 || (fwv->major | fwv->minor) == 0) 2500 need_ext_fw = 1; 2501 } else 2502 /* No way to check firmware version, reload to be sure */ 2503 need_ext_fw = 1; 2504 2505 if (need_ext_fw) { 2506 dev_printk(KERN_DEBUG, &interface->dev, 2507 "downloading external firmware\n"); 2508 2509 ret = at76_load_external_fw(udev, fwe); 2510 if (ret < 0) 2511 goto exit; 2512 2513 /* Re-check firmware version */ 2514 ret = at76_get_mib(udev, MIB_FW_VERSION, fwv, sizeof(*fwv)); 2515 if (ret < 0) { 2516 dev_err(&interface->dev, 2517 "error %d getting firmware version\n", ret); 2518 goto exit; 2519 } 2520 } 2521 2522 priv = at76_alloc_new_device(udev); 2523 if (!priv) { 2524 ret = -ENOMEM; 2525 goto exit; 2526 } 2527 2528 usb_set_intfdata(interface, priv); 2529 2530 memcpy(&priv->fw_version, fwv, sizeof(struct mib_fw_version)); 2531 priv->board_type = board_type; 2532 2533 ret = at76_init_new_device(priv, interface); 2534 if (ret < 0) 2535 at76_delete_device(priv); 2536 2537 exit: 2538 if (ret < 0) 2539 usb_put_dev(udev); 2540 return ret; 2541 } 2542
Hi Lizhe, Thank you for the patch! Yet something to improve: [auto build test ERROR on wireless-next/main] [also build test ERROR on wireless/main net-next/master net/master linus/master v6.2-rc3 next-20230113] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Lizhe/wireless-at76c50x-usb-c-Use-devm_kmalloc-replaces-kmalloc/20230113-221810 base: https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main patch link: https://lore.kernel.org/r/20230113141231.71892-1-sensor1010%40163.com patch subject: [PATCH v1] wireless/at76c50x-usb.c : Use devm_kmalloc replaces kmalloc config: i386-allmodconfig compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/0014c43a8d5f050965cc8fd562a8f0c21952f64b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Lizhe/wireless-at76c50x-usb-c-Use-devm_kmalloc-replaces-kmalloc/20230113-221810 git checkout 0014c43a8d5f050965cc8fd562a8f0c21952f64b # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/wireless/atmel/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/net/wireless/atmel/at76c50x-usb.c:2447:45: error: too few arguments to function call, expected 3, have 2 fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); ~~~~~~~~~~~~ ^ include/linux/device.h:200:7: note: 'devm_kmalloc' declared here void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp) __malloc; ^ 1 error generated. vim +2447 drivers/net/wireless/atmel/at76c50x-usb.c 2432 2433 static int at76_probe(struct usb_interface *interface, 2434 const struct usb_device_id *id) 2435 { 2436 int ret; 2437 struct at76_priv *priv; 2438 struct fwentry *fwe; 2439 struct usb_device *udev; 2440 int op_mode; 2441 int need_ext_fw = 0; 2442 struct mib_fw_version *fwv = NULL; 2443 int board_type = (int)id->driver_info; 2444 2445 udev = usb_get_dev(interface_to_usbdev(interface)); 2446 > 2447 fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); 2448 if (!fwv) { 2449 ret = -ENOMEM; 2450 goto exit; 2451 } 2452 2453 /* Load firmware into kernel memory */ 2454 fwe = at76_load_firmware(udev, board_type); 2455 if (!fwe) { 2456 ret = -ENOENT; 2457 goto exit; 2458 } 2459 2460 op_mode = at76_get_op_mode(udev); 2461 2462 at76_dbg(DBG_DEVSTART, "opmode %d", op_mode); 2463 2464 /* we get OPMODE_NONE with 2.4.23, SMC2662W-AR ??? 2465 we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */ 2466 2467 if (op_mode == OPMODE_HW_CONFIG_MODE) { 2468 dev_err(&interface->dev, 2469 "cannot handle a device in HW_CONFIG_MODE\n"); 2470 ret = -EBUSY; 2471 goto exit; 2472 } 2473 2474 if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH 2475 && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) { 2476 /* download internal firmware part */ 2477 dev_printk(KERN_DEBUG, &interface->dev, 2478 "downloading internal firmware\n"); 2479 ret = at76_load_internal_fw(udev, fwe); 2480 if (ret < 0) { 2481 dev_err(&interface->dev, 2482 "error %d downloading internal firmware\n", 2483 ret); 2484 } 2485 goto exit; 2486 } 2487 2488 /* Internal firmware already inside the device. Get firmware 2489 * version to test if external firmware is loaded. 2490 * This works only for newer firmware, e.g. the Intersil 0.90.x 2491 * says "control timeout on ep0in" and subsequent 2492 * at76_get_op_mode() fail too :-( */ 2493 2494 /* if version >= 0.100.x.y or device with built-in flash we can 2495 * query the device for the fw version */ 2496 if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100) 2497 || (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) { 2498 ret = at76_get_mib(udev, MIB_FW_VERSION, fwv, sizeof(*fwv)); 2499 if (ret < 0 || (fwv->major | fwv->minor) == 0) 2500 need_ext_fw = 1; 2501 } else 2502 /* No way to check firmware version, reload to be sure */ 2503 need_ext_fw = 1; 2504 2505 if (need_ext_fw) { 2506 dev_printk(KERN_DEBUG, &interface->dev, 2507 "downloading external firmware\n"); 2508 2509 ret = at76_load_external_fw(udev, fwe); 2510 if (ret < 0) 2511 goto exit; 2512 2513 /* Re-check firmware version */ 2514 ret = at76_get_mib(udev, MIB_FW_VERSION, fwv, sizeof(*fwv)); 2515 if (ret < 0) { 2516 dev_err(&interface->dev, 2517 "error %d getting firmware version\n", ret); 2518 goto exit; 2519 } 2520 } 2521 2522 priv = at76_alloc_new_device(udev); 2523 if (!priv) { 2524 ret = -ENOMEM; 2525 goto exit; 2526 } 2527 2528 usb_set_intfdata(interface, priv); 2529 2530 memcpy(&priv->fw_version, fwv, sizeof(struct mib_fw_version)); 2531 priv->board_type = board_type; 2532 2533 ret = at76_init_new_device(priv, interface); 2534 if (ret < 0) 2535 at76_delete_device(priv); 2536 2537 exit: 2538 if (ret < 0) 2539 usb_put_dev(udev); 2540 return ret; 2541 } 2542
On Fri, Jan 13, 2023 at 06:12:31AM -0800, Lizhe wrote: > use devm_kmalloc replaces kmalloc No, it is not. > > Signed-off-by: Lizhe <sensor1010@163.com> > --- > drivers/net/wireless/atmel/at76c50x-usb.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c > index 009bca34ece3..f486ddb83d46 100644 > --- a/drivers/net/wireless/atmel/at76c50x-usb.c > +++ b/drivers/net/wireless/atmel/at76c50x-usb.c > @@ -2444,7 +2444,7 @@ static int at76_probe(struct usb_interface *interface, > > udev = usb_get_dev(interface_to_usbdev(interface)); > > - fwv = kmalloc(sizeof(*fwv), GFP_KERNEL); > + fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); > if (!fwv) { > ret = -ENOMEM; > goto exit; > @@ -2535,7 +2535,6 @@ static int at76_probe(struct usb_interface *interface, > at76_delete_device(priv); > > exit: > - kfree(fwv); > if (ret < 0) > usb_put_dev(udev); > return ret; > -- > 2.17.1 >
diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c index 009bca34ece3..f486ddb83d46 100644 --- a/drivers/net/wireless/atmel/at76c50x-usb.c +++ b/drivers/net/wireless/atmel/at76c50x-usb.c @@ -2444,7 +2444,7 @@ static int at76_probe(struct usb_interface *interface, udev = usb_get_dev(interface_to_usbdev(interface)); - fwv = kmalloc(sizeof(*fwv), GFP_KERNEL); + fwv = devm_kmalloc(sizeof(*fwv), GFP_KERNEL); if (!fwv) { ret = -ENOMEM; goto exit; @@ -2535,7 +2535,6 @@ static int at76_probe(struct usb_interface *interface, at76_delete_device(priv); exit: - kfree(fwv); if (ret < 0) usb_put_dev(udev); return ret;