Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4197929rwb; Tue, 6 Sep 2022 04:13:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR7qBYexKRqRKRIzjM1q+ljpokidHnhs8qI0G6AUrbbRPlPpTFRrMz8LGByGdnNRd4a7L11a X-Received: by 2002:a05:6402:2c6:b0:44e:7d0a:c231 with SMTP id b6-20020a05640202c600b0044e7d0ac231mr8286381edx.283.1662462822814; Tue, 06 Sep 2022 04:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662462822; cv=none; d=google.com; s=arc-20160816; b=LNvRuUEA4WgTL/oE5/mo2YidpmdhWCrfmNX1TC2iKCtN/a6dcsJl0wBR0XDhR5vEnJ uU0E2j5YptZ1CvNF0FjLgBi5KBPtgQxO68uo8KlqO++uuOTbE8oTdJZEH0Tzkhij/xiR 4ByRoX+TPo+IGefJXCReACS1ny/JWnh3X7AgIYi/Oa6npL23vsiV3RB+LArGC/yJtiLo uwS6hI7GHlIoU67I3ydqW03xIf9b5/Rn32828ch5JeaVIbuImQwGPAAwH3O6fi86pm7e I+TayoOKmzp222wPuWdvrG2I4dFO/AHpbatpWXsK+0fazr6MOV7O1Czh6bKrS6vEU9QY 4GTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pS17w8gQuXATYP0dMzitVnnnq2rGLACSmuuJANdie7I=; b=YreNA5KNrVnhvL9y45cOOspVhKtD6ycmBst6WRH8KAnaUhiaPtbIci8aMBzbUR9LR1 SmiGH+CA7urm01irFQ8gnMViaVPPkk2X7bdbsaAP0nnSOUTHcp/RK9H+mcr3um2Nc28l vOSaSZLTNjiAMVVcdVk3qHMINgAq+RRLRdrP2H6velewAWivjtDW+7/3HblyRg3JCtZ9 wKF1CjFx750UHHGdR/oATknigFUadFDzbTJRDsrYYJ16YdAAYn9351hJNK3Xxpj9oTRz UXSeYi+dY2EIA9BjKq0aH+JTPoiVsb+0bLVGME8NANiSs56okIhX0y/uXTZiMrq/+dFB 0w1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=M0Vy69RM; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a056402124600b00447bac336ebsi758946edw.527.2022.09.06.04.13.05; Tue, 06 Sep 2022 04:13:42 -0700 (PDT) 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=@intel.com header.s=Intel header.b=M0Vy69RM; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239939AbiIFKrn (ORCPT + 99 others); Tue, 6 Sep 2022 06:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239833AbiIFKqd (ORCPT ); Tue, 6 Sep 2022 06:46:33 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F8F275CCA; Tue, 6 Sep 2022 03:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662461126; x=1693997126; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nAdc8Rr843R6WJOu79NKjIig8n6+aOXK81VmIUMIj3g=; b=M0Vy69RMHMHQN2GsgOb9w/bZh5RFY5aBqudnM0EftW5rHxW2VfFDPDWo QVNCoPMi38tOEu2uTlCGU1Ip23q3FZ5ZyhM03w05No8lyTJwCm9UuTBwX z+TON5R+hmumaEVvvjEmWBkgMk+XBAhe+WBh3LsxuE9J+UJ4clhyhGCfY pIe6KohlRXipDDN8KbTrEEBdI458x//SH8rrgaV7dgLcg/QwZViqaIEjY uBd0qFCYJXnp6xyaYhb+Y5pqHIk4JZBXeL1dXB2dm7L4FYwqi4HP+7bNJ QGoh/eP67X1l+hS/6YGvAoruJBhk9RZI1EQSOtAeew1EtyWm7Beq4XrUZ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="358277620" X-IronPort-AV: E=Sophos;i="5.93,294,1654585200"; d="scan'208";a="358277620" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 03:45:12 -0700 X-IronPort-AV: E=Sophos;i="5.93,294,1654585200"; d="scan'208";a="644121884" Received: from unknown (HELO localhost.localdomain) ([10.237.112.144]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 03:45:09 -0700 Date: Tue, 6 Sep 2022 12:45:00 +0200 From: Michal Swiatkowski To: Christophe JAILLET Cc: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , intel-wired-lan@lists.osuosl.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [Intel-wired-lan] [PATCH] ice: switch: Simplify memory allocation Message-ID: References: <55ff1825aee6e655c41cb6770ca44f0fbdbfec00.1662301068.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55ff1825aee6e655c41cb6770ca44f0fbdbfec00.1662301068.git.christophe.jaillet@wanadoo.fr> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 04, 2022 at 04:18:02PM +0200, Christophe JAILLET wrote: > 'rbuf' is locale to the ice_get_initial_sw_cfg() function. > There is no point in using devm_kzalloc()/devm_kfree(). > > use kzalloc()/kfree() instead. > > Signed-off-by: Christophe JAILLET > --- > As a side effect, it also require less memory. devm_kzalloc() has a small > memory overhead, and requesting ICE_SW_CFG_MAX_BUF_LEN (i.e. 2048) bytes, > 4096 are really allocated. > --- > drivers/net/ethernet/intel/ice/ice_switch.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c > index 697feb89188c..eb6e19deb70d 100644 > --- a/drivers/net/ethernet/intel/ice/ice_switch.c > +++ b/drivers/net/ethernet/intel/ice/ice_switch.c > @@ -2274,9 +2274,7 @@ int ice_get_initial_sw_cfg(struct ice_hw *hw) > int status; > u16 i; > > - rbuf = devm_kzalloc(ice_hw_to_dev(hw), ICE_SW_CFG_MAX_BUF_LEN, > - GFP_KERNEL); > - > + rbuf = kzalloc(ICE_SW_CFG_MAX_BUF_LEN, GFP_KERNEL); > if (!rbuf) > return -ENOMEM; > > @@ -2324,7 +2322,7 @@ int ice_get_initial_sw_cfg(struct ice_hw *hw) > } > } while (req_desc && !status); > > - devm_kfree(ice_hw_to_dev(hw), rbuf); > + kfree(rbuf); > return status; > } > > -- > 2.34.1 > Thanks for catching that Reviewed-by: Michal Swiatkowski > _______________________________________________ > Intel-wired-lan mailing list > Intel-wired-lan@osuosl.org > https://lists.osuosl.org/mailman/listinfo/intel-wired-lan