From 6c0ba00c10a49dec8cfdf007dfd60f94edb493ab Mon Sep 17 00:00:00 2001 From: Janne Peltonen Date: Mon, 8 Jun 2020 17:23:14 +0300 Subject: helper: do not ignore the return value of odp_pool_destroy() Either check the return value of odp_pool_destroy() or explicitly cast it to void to silence complaints from a static analyzer. Signed-off-by: Janne Peltonen Reviewed-by: Petri Savolainen --- helper/cuckootable.c | 8 ++++++-- helper/iplookuptable.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'helper') diff --git a/helper/cuckootable.c b/helper/cuckootable.c index 237c2f297..47dd90b6c 100644 --- a/helper/cuckootable.c +++ b/helper/cuckootable.c @@ -260,7 +260,11 @@ odph_cuckoo_table_create( pool = odp_pool_lookup(pool_name); if (pool != ODP_POOL_INVALID) - odp_pool_destroy(pool); + if (odp_pool_destroy(pool)) { + odp_shm_free(shm_tbl); + ODPH_DBG("failed to destroy pre-existing pool\n"); + return NULL; + } odp_pool_param_init(¶m); param.type = ODP_POOL_BUFFER; @@ -285,7 +289,7 @@ odph_cuckoo_table_create( queue = odp_queue_create(queue_name, &qparam); if (queue == ODP_QUEUE_INVALID) { ODPH_DBG("failed to create free_slots queue\n"); - odp_pool_destroy(pool); + (void)odp_pool_destroy(pool); odp_shm_free(shm_tbl); return NULL; } diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c index c02ee5415..eacfcf5f8 100644 --- a/helper/iplookuptable.c +++ b/helper/iplookuptable.c @@ -150,7 +150,7 @@ cache_destroy(odph_iplookup_table_impl *impl) sprintf( pool_name, "%s_%d_%d", impl->name, i, count); - odp_pool_destroy(odp_pool_lookup(pool_name)); + (void)odp_pool_destroy(odp_pool_lookup(pool_name)); } } } -- cgit v1.2.3 From 51612524585887e6659ed75a123e8d69301b6304 Mon Sep 17 00:00:00 2001 From: Stanislaw Kardach Date: Thu, 23 Jan 2020 11:41:31 +0100 Subject: build: do not define libodp as part of helper This prevents multiple inclusion of libodp-linux during builds, once as part of libodphelper and then directly by the application. This causes problems when linking statically with LTO enabled. On tested compiler (9.2.1-9ubuntu2) such duplication causes constructor symbols to be defined multiple times. This means that constructors will be run multiple times which leads to unexpected behavior. To fix this, remove libodp from helper link list. This works when compiling applications because there is no point in using libodphelper without libodp-linux, therefore both libraries have to be provided. After removing library order in example/Makefile.inc is required to ensure the proper linking. Signed-off-by: Stanislaw Kardach Signed-off-by: Nithin Dabilpuram Reviewed-by: Matias Elo Reviewed-by: Petri Savolainen --- helper/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'helper') diff --git a/helper/Makefile.am b/helper/Makefile.am index cfeeeeb40..aa645cc8e 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -60,6 +60,6 @@ __LIB__libodphelper_la_SOURCES += \ linux/thread.c endif -__LIB__libodphelper_la_LIBADD = $(PTHREAD_LIBS) $(LIB)/libodp-linux.la +__LIB__libodphelper_la_LIBADD = $(PTHREAD_LIBS) lib_LTLIBRARIES = $(LIB)/libodphelper.la -- cgit v1.2.3