[dpdk-dev] [PATCH] app/testpmd: fix runtime dead code

Michal Jastrzebski michalx.k.jastrzebski at intel.com
Fri Sep 29 14:56:56 CEST 2017


From: Tomasz Kulasek <tomaszx.kulasek at intel.com>

Coverity reports DEADCODE, as assumes that RTE_LIBRTE_I40E_PMD
is defined and function compiles entirely. 
The fix is about to place printf function into #else branch
of conditional compilation, since it is known at compile
time if i40e is supported. No need to check it at runtime. 

Coverity issue: 158646
Fixes: 37a56cce7b8e ("app/testpmd: enable DDP get info feature")
Cc: andrey.chilikin at intel.com
Cc: stable at dpdk.org

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
---
 app/test-pmd/cmdline.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ccdf239..c604dac 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -13414,8 +13414,8 @@ struct cmd_ddp_info_result {
 	struct cmd_ddp_info_result *res = parsed_result;
 	uint8_t *pkg;
 	uint32_t pkg_size;
-	int ret = -ENOTSUP;
 #ifdef RTE_LIBRTE_I40E_PMD
+	int ret;
 	uint32_t i;
 	uint8_t *buff;
 	uint32_t buff_size;
@@ -13495,10 +13495,9 @@ struct cmd_ddp_info_result {
 			free(devs);
 		}
 	}
-	ret = 0;
+#else
+	printf("Function not supported in PMD driver\n");
 #endif
-	if (ret == -ENOTSUP)
-		printf("Function not supported in PMD driver\n");
 	close_ddp_package_file(pkg);
 }
 
-- 
1.9.1



More information about the dev mailing list