[ovs-dev] [PATCH v5 4/6] netdev-dpdk: assert mempool names.

antonio.fischetti at intel.com antonio.fischetti at intel.com
Wed Oct 11 16:00:54 UTC 2017


Replace if statement with an assert.

CC: Darrell Ball <dlu998 at gmail.com>
CC: Ciara Loftus <ciara.loftus at intel.com>
CC: Kevin Traynor <ktraynor at redhat.com>
CC: Aaron Conole <aconole at redhat.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti at intel.com>
---
 lib/netdev-dpdk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 2aa4a55..c451bc9 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -501,9 +501,7 @@ dpdk_mp_name(struct dpdk_mp *dmp)
     char *mp_name = xcalloc(RTE_MEMPOOL_NAMESIZE, sizeof *mp_name);
     int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
                        h, dmp->socket_id, dmp->mtu, dmp->mp_size);
-    if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
-        return NULL;
-    }
+    ovs_assert(ret >= 0 && ret < RTE_MEMPOOL_NAMESIZE);
     return mp_name;
 }
 
-- 
2.4.11



More information about the dev mailing list