Message ID | e86a1ab7b450462a1e92264dccb5a5855546e384.1686516193.git.christophe.jaillet@wanadoo.fr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2223334vqr; Sun, 11 Jun 2023 14:19:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fB/d/ObF7SgcOJVGEx4FfyYQkmKlDM/sC1nUNqrTQ+CWIO0/aggrFflJx7dzZ44ldRwWC X-Received: by 2002:a17:902:7597:b0:1b3:bbe3:25a8 with SMTP id j23-20020a170902759700b001b3bbe325a8mr2952575pll.55.1686518366271; Sun, 11 Jun 2023 14:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686518366; cv=none; d=google.com; s=arc-20160816; b=aqvaMxyrTJ0HItqrizrVp6dbl6YbPTQyU2zM6SOyzZyxcztj3j9XcSQO6SO2Hz/KYC hVF9SE//kRfRxjiK4ecL/McXy4An7QfdV436ZumTY3NkxQs1eWYW9jzSfeBltoIe4Lna SXjFMEEYB4xo7YBLrZUeUi0FVxxnYhkJ+d3QkjGNLXr5QL89pCIPfuPSORcThnisTT8v Ygc31s+cJ+p3W3qSAfnfUgIZZ1yIzltzpMdFCt7OQxYHpRbmHorY4IzuNDLtygjrr07B CCjhLN+4QShe0q5xFqcPP0LLEiWB6qp04GFfkxzOh9cAAKgXfGedDYaMuBgs5wk+SorA pi5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UiEF+Yax2f7tK9mHB7IIdxWz2jAlp2s9xTkNsdxvvkw=; b=K1bZrFTPu+/Y7IW/HePMAIvoYssZsOekrVF3Oc6RWv+qSdpOMoM+E0gQhWPjf3g3lz oSSGwJ0kF7PzHiLXnJeJSJAq6AkDACVy+MVpHB6u0JxFO4pdnVcdzVTYsTTJLuyDcs8m 572Mybe56A+e9JkLJvkpQksjwuIJheaWAvHw5QJaZDGZR8GixKEXu2MG7H5TUOGhGiMi 6dUZLPutbzOEui8c8G9086Un6OVjclgWvW5sr9pcy4hgtm7pznmdczyfqLwIwF0PJejM xp6/P4mx/GlFITLMGk1ita1Hxr8xAT+son3RCcBAzC1T0dyf53vLz47dfsWXz1AaRlY8 frtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=OUYbcJz4; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a17090322ca00b001b3cb03ccacsi761022plg.210.2023.06.11.14.19.10; Sun, 11 Jun 2023 14:19:26 -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=@wanadoo.fr header.s=t20230301 header.b=OUYbcJz4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231939AbjFKUoX (ORCPT <rfc822;liningstudo@gmail.com> + 99 others); Sun, 11 Jun 2023 16:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjFKUoW (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 11 Jun 2023 16:44:22 -0400 Received: from smtp.smtpout.orange.fr (smtp-26.smtpout.orange.fr [80.12.242.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 315A9E53 for <linux-kernel@vger.kernel.org>; Sun, 11 Jun 2023 13:44:19 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 8Rv5qwjzfZnIG8Rv5qdCzN; Sun, 11 Jun 2023 22:44:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686516257; bh=UiEF+Yax2f7tK9mHB7IIdxWz2jAlp2s9xTkNsdxvvkw=; h=From:To:Cc:Subject:Date; b=OUYbcJz4qYNl/rvRcj8m+xkYnIYgYw5GQYzEjeohGePg5f/NCQ8hwaP+KA2NayJR9 9wo1V+vywBUF/RBzAz2/5PuBFXnj/0Pumv0YzR/p0GHPoa8tBx76xKE/EEB4WV7TIy RyeSIE2ybOJ2nDKb/sSutIi5Gk+NTRKPv+sOcgvJOe89LUM8dsLItS05cgRvcGguI8 XtgUsQBFlGN/AqyLmN7CtnL3gCdjewsqhU16bNZpQhctYekQU1iorp9X7RZD038Z8n /DGcOik+Xj5t5duaZZ3W3HuTPTCqjC+UPykoE5W1Reir3MyjLEIhDLR2sEM8iMMTgB S7YmbF3ZWGfQg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 11 Jun 2023 22:44:17 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> To: Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH net-next] ice: Remove managed memory usage in ice_get_fw_log_cfg() Date: Sun, 11 Jun 2023 22:44:13 +0200 Message-Id: <e86a1ab7b450462a1e92264dccb5a5855546e384.1686516193.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, 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: <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?1768442682797502265?= X-GMAIL-MSGID: =?utf-8?q?1768442682797502265?= |
Series |
[net-next] ice: Remove managed memory usage in ice_get_fw_log_cfg()
|
|
Commit Message
Christophe JAILLET
June 11, 2023, 8:44 p.m. UTC
There is no need to use managed memory allocation here. The memory is
released at the end of the function.
You kzalloc()/kfree() to simplify the code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/net/ethernet/intel/ice/ice_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, Jun 12, 2023 at 2:14 AM Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > > There is no need to use managed memory allocation here. The memory is > released at the end of the function. > > You kzalloc()/kfree() to simplify the code. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > drivers/net/ethernet/intel/ice/ice_common.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Looks good to me. Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> > > diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c > index eb2dc0983776..4b799a5d378a 100644 > --- a/drivers/net/ethernet/intel/ice/ice_common.c > +++ b/drivers/net/ethernet/intel/ice/ice_common.c > @@ -834,7 +834,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) > u16 size; > > size = sizeof(*config) * ICE_AQC_FW_LOG_ID_MAX; > - config = devm_kzalloc(ice_hw_to_dev(hw), size, GFP_KERNEL); > + config = kzalloc(size, GFP_KERNEL); > if (!config) > return -ENOMEM; > > @@ -857,7 +857,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) > } > } > > - devm_kfree(ice_hw_to_dev(hw), config); > + kfree(config); > > return status; > } > -- > 2.34.1 > >
> -----Original Message----- > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of > Christophe JAILLET > Sent: Sunday, June 11, 2023 1:44 PM > To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; David S. Miller <davem@davemloft.net>; Eric > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com> > Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>; intel-wired- > lan@lists.osuosl.org; kernel-janitors@vger.kernel.org; linux- > kernel@vger.kernel.org; netdev@vger.kernel.org > Subject: [Intel-wired-lan] [PATCH net-next] ice: Remove managed memory usage > in ice_get_fw_log_cfg() > > There is no need to use managed memory allocation here. The memory is > released at the end of the function. > > You kzalloc()/kfree() to simplify the code. > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- Agreed. Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> > drivers/net/ethernet/intel/ice/ice_common.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_common.c > b/drivers/net/ethernet/intel/ice/ice_common.c > index eb2dc0983776..4b799a5d378a 100644 > --- a/drivers/net/ethernet/intel/ice/ice_common.c > +++ b/drivers/net/ethernet/intel/ice/ice_common.c > @@ -834,7 +834,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) > u16 size; > > size = sizeof(*config) * ICE_AQC_FW_LOG_ID_MAX; > - config = devm_kzalloc(ice_hw_to_dev(hw), size, GFP_KERNEL); > + config = kzalloc(size, GFP_KERNEL); > if (!config) > return -ENOMEM; > > @@ -857,7 +857,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) > } > } > > - devm_kfree(ice_hw_to_dev(hw), config); > + kfree(config); > > return status; > } > -- > 2.34.1 > > _______________________________________________ > Intel-wired-lan mailing list > Intel-wired-lan@osuosl.org > https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Dear Christophe, Thank you for the patch. Am 11.06.23 um 22:44 schrieb Christophe JAILLET: > There is no need to use managed memory allocation here. The memory is > released at the end of the function. > > You kzalloc()/kfree() to simplify the code. s/You/Use/? Kind regards, Paul > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> > --- > drivers/net/ethernet/intel/ice/ice_common.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c > index eb2dc0983776..4b799a5d378a 100644 > --- a/drivers/net/ethernet/intel/ice/ice_common.c > +++ b/drivers/net/ethernet/intel/ice/ice_common.c > @@ -834,7 +834,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) > u16 size; > > size = sizeof(*config) * ICE_AQC_FW_LOG_ID_MAX; > - config = devm_kzalloc(ice_hw_to_dev(hw), size, GFP_KERNEL); > + config = kzalloc(size, GFP_KERNEL); > if (!config) > return -ENOMEM; > > @@ -857,7 +857,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) > } > } > > - devm_kfree(ice_hw_to_dev(hw), config); > + kfree(config); > > return status; > }
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index eb2dc0983776..4b799a5d378a 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -834,7 +834,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) u16 size; size = sizeof(*config) * ICE_AQC_FW_LOG_ID_MAX; - config = devm_kzalloc(ice_hw_to_dev(hw), size, GFP_KERNEL); + config = kzalloc(size, GFP_KERNEL); if (!config) return -ENOMEM; @@ -857,7 +857,7 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw) } } - devm_kfree(ice_hw_to_dev(hw), config); + kfree(config); return status; }