[v2,5/6] dpdk-devbind: fix unnecessary else after return
diff mbox series

Message ID 20201104070350.28224-6-stephen@networkplumber.org
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series
  • dpdk-devbind: python lint cleanups
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Nov. 4, 2020, 7:03 a.m. UTC
Python lint complains about
 Unnecessary "else" after "return" (no-else-return)

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 usertools/dpdk-devbind.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Patch
diff mbox series

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index afe93a217d79..47373e27bd74 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -274,13 +274,13 @@  def dev_id_from_dev_name(dev_name):
     if dev_name in devices:
         return dev_name
     # check if it's an index just missing the domain part
-    elif "0000:" + dev_name in devices:
+    if "0000:" + dev_name in devices:
         return "0000:" + dev_name
-    else:
-        # check if it's an interface name, e.g. eth1
-        for d in devices.keys():
-            if dev_name in devices[d]["Interface"].split(","):
-                return devices[d]["Slot"]
+
+    # check if it's an interface name, e.g. eth1
+    for d in devices.keys():
+        if dev_name in devices[d]["Interface"].split(","):
+            return devices[d]["Slot"]
     # if nothing else matches - error
     raise ValueError("Unknown device: %s. "
                      "Please specify device in \"bus:slot.func\" format" % dev_name)
@@ -329,10 +329,9 @@  def bind_one(dev_id, driver, force):
             print("Notice: %s already bound to driver %s, skipping" %
                   (dev_id, driver), file=sys.stderr)
             return
-        else:
-            saved_driver = dev["Driver_str"]
-            unbind_one(dev_id, force)
-            dev["Driver_str"] = ""  # clear driver string
+        saved_driver = dev["Driver_str"]
+        unbind_one(dev_id, force)
+        dev["Driver_str"] = ""  # clear driver string
 
     # For kernels >= 3.15 driver_override can be used to specify the driver
     # for a device rather than relying on the driver to provide a positive