From: Zhirun Yan <zhirun.yan@intel.com>
To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com,
ndabilpuram@marvell.com
Cc: Zhirun Yan <zhirun.yan@intel.com>
Subject: [PATCH v1] test/graph: fix unused return value
Date: Fri, 21 Jul 2023 10:13:16 +0800 [thread overview]
Message-ID: <20230721021316.1473047-1-zhirun.yan@intel.com> (raw)
Return value stored in "ret" but it may be overwritten before use.
Add goto to return when meet an error. Issue reported by coverity scan.
Coverity issue: 395532
Fixes: 15f483feec65 ("graph: fix model check in core binding")
Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
---
app/test/test_graph.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index af90ac07ec..7995f67757 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -740,13 +740,13 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void)
ret = rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH);
if (ret != 0) {
printf("Set graph mcore dispatch model failed\n");
- ret = -1;
+ goto fail;
}
ret = rte_graph_model_mcore_dispatch_core_bind(cloned_graph_id, worker_lcore);
if (ret != 0) {
printf("bind graph %d to lcore %u failed\n", graph_id, worker_lcore);
- ret = -1;
+ goto fail;
}
graph = rte_graph_lookup("worker0-cloned-test2");
@@ -755,6 +755,7 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void)
printf("bind graph %s(id:%d) with lcore %u failed\n",
graph->name, graph->id, worker_lcore);
ret = -1;
+ goto fail;
}
rte_graph_model_mcore_dispatch_core_unbind(cloned_graph_id);
@@ -764,6 +765,7 @@ test_graph_model_mcore_dispatch_core_bind_unbind(void)
ret = -1;
}
+fail:
rte_graph_destroy(cloned_graph_id);
return ret;
@@ -781,7 +783,7 @@ test_graph_worker_model_set_get(void)
ret = rte_graph_worker_model_set(RTE_GRAPH_MODEL_MCORE_DISPATCH);
if (ret != 0) {
printf("Set graph mcore dispatch model failed\n");
- ret = -1;
+ goto fail;
}
graph = rte_graph_lookup("worker0-cloned-test3");
@@ -790,9 +792,10 @@ test_graph_worker_model_set_get(void)
ret = -1;
}
+fail:
rte_graph_destroy(cloned_graph_id);
- return 0;
+ return ret;
}
static int
--
2.37.2
next reply other threads:[~2023-07-21 2:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 2:13 Zhirun Yan [this message]
2023-07-21 12:50 ` Jerin Jacob
2023-09-27 0:48 ` Yan, Zhirun
2023-10-17 12:01 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230721021316.1473047-1-zhirun.yan@intel.com \
--to=zhirun.yan@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).