[dpdk-dev] [PATCH] lib/librte_eal/common/rte_malloc: remove redundant check for size and alignment

Sarosh Arif sarosh.arif at emumba.com
Wed Jul 15 15:31:36 CEST 2020


Since mallock_socket() always calls malloc_heap_alloc() and
this check is present inside malloc_heap_alloc() so there is
no need to place it in mallock_socket(). 

Signed-off-by: Sarosh Arif <sarosh.arif at emumba.com>
---
 lib/librte_eal/common/rte_malloc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
index 9d39e58c0..51256117b 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -61,10 +61,6 @@ malloc_socket(const char *type, size_t size, unsigned int align,
 {
 	void *ptr;
 
-	/* return NULL if size is 0 or alignment is not power-of-2 */
-	if (size == 0 || (align && !rte_is_power_of_2(align)))
-		return NULL;
-
 	/* if there are no hugepages and if we are not allocating from an
 	 * external heap, use memory from any socket available. checking for
 	 * socket being external may return -1 in case of invalid socket, but
-- 
2.17.1



More information about the dev mailing list