[dpdk-dev] [PATCH 5/5] app/eventdev: fix possible uninitialized variable

Thomas Monjalon thomas at monjalon.net
Fri Nov 16 17:58:54 CET 2018


When compiling with -O1, this error can appear:
	app/test-eventdev/test_pipeline_common.c:332:6: error:
	‘ret’ may be used uninitialized in this function

If there is no device, then ret is returned without being initialized.
It is fixed by setting 0 as initial value.

Fixes: 032a965a8f1d ("app/eventdev: support Tx adapter")
Cc: pbhagavatula at caviumnetworks.com

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
 app/test-eventdev/test_pipeline_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index d07fa8826..5db3ffde1 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -329,7 +329,7 @@ int
 pipeline_event_tx_adapter_setup(struct evt_options *opt,
 		struct rte_event_port_conf port_conf)
 {
-	int ret;
+	int ret = 0;
 	uint16_t consm;
 
 	RTE_ETH_FOREACH_DEV(consm) {
-- 
2.19.0



More information about the dev mailing list