[ovs-dev] [PATCH 1/3] dpif-netlink-rtnl: Tidy up some code.

Joe Stringer joe at ovn.org
Fri May 19 20:27:34 UTC 2017


Simplify and refactor a couple of bits of code for improved readability.

Signed-off-by: Joe Stringer <joe at ovn.org>
---
 lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
index 7faad5248037..0ca6529e9d82 100644
--- a/lib/dpif-netlink-rtnl.c
+++ b/lib/dpif-netlink-rtnl.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2017 Red Hat, Inc.
+ * Copyright (c) 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -369,17 +370,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
         err = dpif_netlink_rtnl_verify(tnl_cfg, type, name);
         if (!err) {
             return 0;
-        } else {
-            err = dpif_netlink_rtnl_destroy(name);
-            if (err) {
-                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-
-                VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
-                             "deleted: %s", name, ovs_strerror(err));
-                return err;
-            }
-            err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
         }
+        err = dpif_netlink_rtnl_destroy(name);
+        if (err) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+
+            VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
+                         "deleted: %s", name, ovs_strerror(err));
+            return err;
+        }
+        err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
     }
     if (err) {
         return err;
-- 
2.11.1



More information about the dev mailing list