[PATCH 2/4] eal: simplify check condition

Ruifeng Wang ruifeng.wang at arm.com
Fri May 19 06:29:21 CEST 2023


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 <ruifeng.wang at arm.com>
Reviewed-by: Feifei Wang <feifei.wang2 at arm.com>
---
 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



More information about the dev mailing list