From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 53708A04E7; Wed, 4 Nov 2020 08:05:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E81B7C83A; Wed, 4 Nov 2020 08:04:05 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 9DF75C81A for ; Wed, 4 Nov 2020 08:04:01 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id i7so13845304pgh.6 for ; Tue, 03 Nov 2020 23:04:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O0hDDPqJ1rsd2SwIvXX4b+gAgam1T4WP0pY3Y22C0tg=; b=UroUDCQW7wPSaOuYWSQx7ohSl41y4aVWBK9gCZpcHdzSWmXv/UV/w4RoWKkgYjIeId YWk+s7JFqe/On8VxHy/uIi7rEG/79MhYhOy2J1d3P3cnN9MgkOr2wuncKIKMZ1YPUHsb H9n2QsjsqxaFjYBZnLSDD4P2ymExP73MBeaRrF9EBWpAxWCAg/3kIwsOzJru/BKcN5u6 2dRia9pxMTwwbd4SsYh80GWYadfknjMSIg9LdDvbIHtTGQN3LHN5JEdK/C1uG05lYvHN Aa2u/Ic7uMUXLL0iSF7g69C0v5wfY51K2+/MLugjy1i+ulr/LNAP7hKQYZkY7Wo9XY0m GwZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O0hDDPqJ1rsd2SwIvXX4b+gAgam1T4WP0pY3Y22C0tg=; b=fm1aPVfxeXE6qPB8wdVTe1I6JmabVrcAYHFkHBBh+qicdNeyVRBUiQOQkcBLVyS2Mo Z7MVPH5hkMRhUCI2vAUkDYpK4X2FiudJF825FXqTUdhUQWVdUMVJArFB3oFXL7OEP6F1 XAUi/FHaNw9MvQm+bVX0BVDFnq02RulE+DRd0y+H40PDOK1o0umKZhZRGHEVC+nOvklh bTjhfTiGcJ51SYu36fSdkSfCszhrYikKnwKzmsXlJl9+uzVdBU2Xg5X+sgYpaTru2+KF 6xaqd6eD/rygEIqgX8hLizsYsuqzO9nnmKQiQPx6QlVgxthPqRPFCYozajIgvlMsAX8z NLFA== X-Gm-Message-State: AOAM5315nMrUo20chRt1Zx93HN6F6eYQgOZIA6SS4HqGlcJNDf50B+7E 1zPt6T50hd1SW6I2ViCdYxPDzC10nvnqI4Oq X-Google-Smtp-Source: ABdhPJx1NLMsjoBDJxSRAKOQIV7/OvVix4pmkLS4dNZvrwFnZJ8TqQdcCgG/LGTbYHUHbb+B5XFOKQ== X-Received: by 2002:a17:90a:1546:: with SMTP id y6mr2920386pja.167.1604473439422; Tue, 03 Nov 2020 23:03:59 -0800 (PST) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z21sm1181177pfa.158.2020.11.03.23.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 23:03:58 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 3 Nov 2020 23:03:49 -0800 Message-Id: <20201104070350.28224-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201104070350.28224-1-stephen@networkplumber.org> References: <20200906013133.26360-12-stephen@networkplumber.org> <20201104070350.28224-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 5/6] dpdk-devbind: fix unnecessary else after return X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Python lint complains about Unnecessary "else" after "return" (no-else-return) Signed-off-by: Stephen Hemminger --- usertools/dpdk-devbind.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) 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 -- 2.27.0