Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2053537rwb; Sun, 4 Sep 2022 07:24:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hu1ub0z4cK76DhLLofjar9EhY7TqAn+vvVUv01f3T3DMD8OaNiHH/TzeQzdzwc45VBL7i X-Received: by 2002:a17:90b:1bc2:b0:1fe:1ad3:4a81 with SMTP id oa2-20020a17090b1bc200b001fe1ad34a81mr14536563pjb.61.1662301475054; Sun, 04 Sep 2022 07:24:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662301475; cv=none; d=google.com; s=arc-20160816; b=C4ML5wG2/jsSzY5Amjdc0RwOtOVgNPpHHn7xVGLHvIHeQcXSn0isJejQgBe+8XOWog /tv2IQkqnhmBfBiZ4Qsjp1OuEre0Uzge0S0eBt6ceHR9AYrvzBbiCoUJ7H8DPawhqFLN 1OVfXDtf7ycf5tXL+9mN8eBnKgYJVort88sBT+cO2389kM9Xnin4wtm9s2rnaCQFyJgw GvJa/ktaU+gflh2PclD1zsPeNDQnrviIBSzDv4rBAAakWiL2FmpHoLCkdr8oMK1GXtk5 aJKODZD3wlKkUB0uj3eXwVn+DHmw3fsbvqeF56ipkB8jiO4DTKDMKdeSgM2pvDIawpuv 6qPw== 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; bh=fPV0ReUcktB1vC9jvK7GSWclvF3AcguGF9vRWV9G9yI=; b=AvH+9foZFRQHM2YCNWBi3R0oCXusyZ9rFx5z1lilzHXwoi7yP9xeynqk7FzD/Mqeab /loQ+yj+21SGelwm28hbho/I73Y5VXGKbVTXEU5TfHWjS4d+sJ8YCcjG/xtChIhFsG6S CaC6Y7qqMEl5cLTjsHsahi0IIBFZE+ruWQCaClLubLD+Q0Txl+awGWkIQ5R6NtF8SnI/ Bghr5VGpkGhwQu/8dOKdnMJGb83Arp34tR3/E9mKs+XkUeiqO3PqKDgKCobDL71uyBhF hn+ZQpdOkwvcme1zbcytXn9CImNT36O5mjkrw1yrcu5XDiOJA0Dnr2+zq/029iFj1sel sljA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na14-20020a17090b4c0e00b001fde53d5d79si14275928pjb.5.2022.09.04.07.24.23; Sun, 04 Sep 2022 07:24:35 -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; 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 S234122AbiIDOSM (ORCPT + 99 others); Sun, 4 Sep 2022 10:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229754AbiIDOSK (ORCPT ); Sun, 4 Sep 2022 10:18:10 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB43D2C643 for ; Sun, 4 Sep 2022 07:18:08 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id UqRoo6N75sfCIUqRooeLOU; Sun, 04 Sep 2022 16:18:07 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 04 Sep 2022 16:18:07 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH] ice: switch: Simplify memory allocation Date: Sun, 4 Sep 2022 16:18:02 +0200 Message-Id: <55ff1825aee6e655c41cb6770ca44f0fbdbfec00.1662301068.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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,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: X-Mailing-List: linux-kernel@vger.kernel.org '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