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.w...@arm.com> Reviewed-by: Feifei Wang <feifei.wa...@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