]> git.proxmox.com Git - ovs.git/commitdiff
ovn-nbctl, ovn-sbctl, ovs-vsctl: Remove gratuitous NULL checks.
authorBen Pfaff <blp@ovn.org>
Sat, 27 May 2017 03:44:19 +0000 (20:44 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 30 May 2017 14:48:28 +0000 (07:48 -0700)
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@ovn.org>
Acked-by: Miguel Angel Ajo <majopela@redhat.com>
ovn/utilities/ovn-nbctl.c
ovn/utilities/ovn-sbctl.c
utilities/ovs-vsctl.c

index 9428a342bec5eb7c50c0001fde1926c1252945e6..b5143e6adfae0a163c41d495421287760a906da8 100644 (file)
@@ -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);
index 0142062fd13ffd6e8bb0f4d2ca66ad9e6a01810d..4a884232f8fde47796ae1c74c16cd1fa02d6fbbb 100644 (file)
@@ -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);
index 9fe3df03af66135b8304d5463cec80cab72b45a7..28c1c4457016f346abf1a57c7081b11870f91502 100644 (file)
@@ -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);