From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EE8D9A034F; Tue, 1 Mar 2022 07:08:06 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE34040DF6; Tue, 1 Mar 2022 07:08:06 +0100 (CET) Received: from out203-205-251-66.mail.qq.com (out203-205-251-66.mail.qq.com [203.205.251.66]) by mails.dpdk.org (Postfix) with ESMTP id 26177407FF for ; Tue, 1 Mar 2022 07:08:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1646114880; bh=MQb7cJfYXQrQQzzlq2aBCh2nQ1uJWFQRUMrOiKRhf+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mHgcFBRp6P682eZ7MLOFYI4l/xXs/p/xeHogcwWLZvyS+6NFP9I6kgqB1M+KkCqVa hbmaAIHqnFdLDKTVCb6L6zVNEtS3e+NPCSKAyfMFIyVOerCypWzwwwmOqy1XUEXS/q 60o2Tq970Z3b97txelk1ODYxtzVzdRFlDfd8Odgo= Received: from localhost.localdomain ([111.193.130.237]) by newxmesmtplogicsvrsza5.qq.com (NewEsmtp) with SMTP id 1F90F87E; Tue, 01 Mar 2022 14:07:57 +0800 X-QQ-mid: xmsmtpt1646114877tdcpfrxke Message-ID: X-QQ-XMAILINFO: MZmsIF9YmPJxYbJBXGZGWoHzdLHd/kwI1pBf6G5zxEyG+2R26FY6a+yP3LjN+G S1po0wRQtoWKMtET9druewWSCLOU15yq5NtMKFUdkWHHoG+tJAHnew94ZU9oUZmqplmzVRNttsPF Cu7AjaImxwsdyBNchTY0v/mwqE1zIE9yjmjEVjCEzmbrm7C8OnPnnOcQ40D7SSDz2/c40LPHHN4Y Eg3xGMnlenuibn5Tcey8V/Fq6geHHvIOL72cI5OhP2Wy7SZyRuTReU6oBLOMFwglgJT0KqiPK3q2 i02wqpXvLJ8ZjxMWWwErDuhfkat+UjNGRIcZJBZAR9zF6gyOKZDAl19rEqWIbaz5iNKVSh5qhUNL HotuhVBVKKKJoap79VsEyJPZAOfQDoRJZwjKrsMlFjKTqEZ7lGDz52ZwVCPiVvs8zMWyjrl5LmJV INQ0iSWoaEfI4i+Ag6BYziT1SnD2nALzG4WXg+qyCwn6PRFRMy8lPs6kBIsoHe4IDsajEfql8JfF 8pajRm2B6hV9v4+5AAMlATBE9bH2d6un6zGRy2s2kSTs/82Yv067Tzs9UqzPdRS1+u2S/i8JSYRP CxNnVkOkWaEN4fIMbDtmKkqGqBkyUpHKYxoLfOz6lycSwnvawwUKFXfFBOzRRSC2IyN05414u7Oe aWgwOpVHbf8JwjEptiy5ajKbXEaSD4DEt95qS4gzQIO69PmJwQWEtegiMJjRs4UPrnq+hKrHEDNn VCk2liWvvS07xxy+S4Zk4+gW2d49hJ4KlPMNluQraBAbJ7MD/0QSZIlVPz4jtzK4YdZREM8bOj4r OogtCoO1k6U5CM0INJo52QM9S1/tB71E+RgLz107CNY6x7gBEwh0jTvnvPIEGMROyXFBjdpM5yzC GGaMQElToI From: Weiguo Li To: cristian.dumitrescu@intel.com Cc: jasvinder.singh@intel.com, wojciechx.liguzinski@intel.com, dev@dpdk.org Subject: [PATCH v3] sched: remove useless malloc in pie data init Date: Tue, 1 Mar 2022 14:07:56 +0800 X-OQ-MSGID: <20220301060756.480838-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to fail when this happen. The malloc inside the function didn't work. So remove the malloc otherwise will lead to a memory leak. Fixes: 44c730b0e37971 ("sched: add PIE based congestion management") Signed-off-by: Weiguo Li --- v3: * fix typo v2: * revise according to Stephen's suggestion. --- lib/sched/rte_pie.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c index cdb7bab697..eed5c12b54 100644 --- a/lib/sched/rte_pie.c +++ b/lib/sched/rte_pie.c @@ -15,13 +15,8 @@ int rte_pie_rt_data_init(struct rte_pie *pie) { if (pie == NULL) { - /* Allocate memory to use the PIE data structure */ - pie = rte_malloc(NULL, sizeof(struct rte_pie), 0); - - if (pie == NULL) - RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); - - return -1; + RTE_LOG(ERR, SCHED, "%s: Invalid addr for pie\n", __func__); + return -EINVAL; } pie->active = 0; -- 2.25.1