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 15B6742B43; Fri, 19 May 2023 06:30:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0868D42D36; Fri, 19 May 2023 06:30:22 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 49D1742D32 for ; Fri, 19 May 2023 06:30:20 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA8212F4; Thu, 18 May 2023 21:31:04 -0700 (PDT) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B7F443F762; Thu, 18 May 2023 21:30:17 -0700 (PDT) From: Ruifeng Wang To: Anatoly Burakov Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, feifei.wang2@arm.com, nd@arm.com, Ruifeng Wang Subject: [PATCH 2/4] eal: simplify check condition Date: Fri, 19 May 2023 12:29:21 +0800 Message-Id: <20230519042923.314670-3-ruifeng.wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230519042923.314670-1-ruifeng.wang@arm.com> References: <20230519042923.314670-1-ruifeng.wang@arm.com> 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 The alt_elem is initialized to null. Checking only size hint flag is sufficient to return a proper value. Removed the redundant check. Signed-off-by: Ruifeng Wang Reviewed-by: Feifei Wang --- lib/eal/common/malloc_heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index d25bdc98f9..fa709ac567 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -168,7 +168,7 @@ find_suitable_element(struct malloc_heap *heap, size_t size, } } - if ((alt_elem != NULL) && (flags & RTE_MEMZONE_SIZE_HINT_ONLY)) + if (flags & RTE_MEMZONE_SIZE_HINT_ONLY) return alt_elem; return NULL; -- 2.25.1