[ovs-dev] [PATCH] ovn-nbctl, ovn-sbctl, ovs-vsctl: Remove gratuitous NULL checks.
Ben Pfaff
blp at ovn.org
Sat May 27 03:44:27 UTC 2017
These functions all set txn and do not un-set it within their main
command execution function, so it's gratuitous to check it along this path.
Found by Coverity.
Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763082&defectInstanceId=4305338&mergedDefectId=180417
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ovn/utilities/ovn-nbctl.c | 9 ++++-----
ovn/utilities/ovn-sbctl.c | 9 ++++-----
utilities/ovs-vsctl.c | 9 ++++-----
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 9428a342bec5..b5143e6adfae 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -3309,11 +3309,10 @@ do_nbctl(const char *args, struct ctl_command *commands, size_t n_commands,
try_again:
/* Our transaction needs to be rerun, or a prerequisite was not met. Free
* resources and return so that the caller can try again. */
- if (txn) {
- ovsdb_idl_txn_abort(txn);
- ovsdb_idl_txn_destroy(txn);
- the_idl_txn = NULL;
- }
+ ovsdb_idl_txn_abort(txn);
+ ovsdb_idl_txn_destroy(txn);
+ the_idl_txn = NULL;
+
ovsdb_symbol_table_destroy(symtab);
for (c = commands; c < &commands[n_commands]; c++) {
ds_destroy(&c->output);
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index 0142062fd13f..4a884232f8fd 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -1344,11 +1344,10 @@ do_sbctl(const char *args, struct ctl_command *commands, size_t n_commands,
try_again:
/* Our transaction needs to be rerun, or a prerequisite was not met. Free
* resources and return so that the caller can try again. */
- if (txn) {
- ovsdb_idl_txn_abort(txn);
- ovsdb_idl_txn_destroy(txn);
- the_idl_txn = NULL;
- }
+ ovsdb_idl_txn_abort(txn);
+ ovsdb_idl_txn_destroy(txn);
+ the_idl_txn = NULL;
+
ovsdb_symbol_table_destroy(symtab);
for (c = commands; c < &commands[n_commands]; c++) {
ds_destroy(&c->output);
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 9fe3df03af66..28c1c4457016 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -2670,11 +2670,10 @@ do_vsctl(const char *args, struct ctl_command *commands, size_t n_commands,
try_again:
/* Our transaction needs to be rerun, or a prerequisite was not met. Free
* resources and return so that the caller can try again. */
- if (txn) {
- ovsdb_idl_txn_abort(txn);
- ovsdb_idl_txn_destroy(txn);
- the_idl_txn = NULL;
- }
+ ovsdb_idl_txn_abort(txn);
+ ovsdb_idl_txn_destroy(txn);
+ the_idl_txn = NULL;
+
ovsdb_symbol_table_destroy(symtab);
for (c = commands; c < &commands[n_commands]; c++) {
ds_destroy(&c->output);
--
2.10.2
More information about the dev
mailing list