[PATCH] net: ena: ethtool: remove redundant non-zero check on rc

Subsystems: amazon ethernet drivers, networking drivers, the rest

STALE2388d

3 messages, 3 authors, 2020-02-24 · open the first message on its own page

[PATCH] net: ena: ethtool: remove redundant non-zero check on rc

From: Colin King <hidden>
Date: 2020-02-21 23:27:02

From: Colin Ian King <redacted>

The non-zero check on rc is redundant as a previous non-zero
check on rc will always return and the second check is never
reached, hence it is redundant and can be removed.  Also
remove a blank line.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <redacted>
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 ----
 1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index ced1d577b62a..1e38930353f2 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -674,7 +674,6 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
 	 * supports getting/setting the hash function.
 	 */
 	rc = ena_com_get_hash_function(adapter->ena_dev, &ena_func, key);
-
 	if (rc) {
 		if (rc == -EOPNOTSUPP) {
 			key = NULL;
@@ -685,9 +684,6 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
 		return rc;
 	}
 
-	if (rc)
-		return rc;
-
 	switch (ena_func) {
 	case ENA_ADMIN_TOEPLITZ:
 		func = ETH_RSS_HASH_TOP;
-- 
2.25.0

RE: [PATCH] net: ena: ethtool: remove redundant non-zero check on rc

From: Jubran, Samih <hidden>
Date: 2020-02-23 08:18:55

Ack, Thanks
quoted hunk
-----Original Message-----
From: Colin King <redacted>
Sent: Saturday, February 22, 2020 1:27 AM
To: Belgazal, Netanel <redacted>; Kiyanovski, Arthur
[off-list ref]; Tzalik, Guy [off-list ref]; Bshara, Saeed
[off-list ref]; Machulsky, Zorik [off-list ref]; David S .
Miller [off-list ref]; Jubran, Samih [off-list ref];
netdev@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: [PATCH] net: ena: ethtool: remove redundant non-zero check on rc

From: Colin Ian King <redacted>

The non-zero check on rc is redundant as a previous non-zero check on rc will
always return and the second check is never reached, hence it is redundant
and can be removed.  Also remove a blank line.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <redacted>
---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 ----
 1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
index ced1d577b62a..1e38930353f2 100644
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
@@ -674,7 +674,6 @@ static int ena_get_rxfh(struct net_device *netdev,
u32 *indir, u8 *key,
 	 * supports getting/setting the hash function.
 	 */
 	rc = ena_com_get_hash_function(adapter->ena_dev, &ena_func,
key);
-
 	if (rc) {
 		if (rc == -EOPNOTSUPP) {
 			key = NULL;
@@ -685,9 +684,6 @@ static int ena_get_rxfh(struct net_device *netdev,
u32 *indir, u8 *key,
 		return rc;
 	}

-	if (rc)
-		return rc;
-
 	switch (ena_func) {
 	case ENA_ADMIN_TOEPLITZ:
 		func = ETH_RSS_HASH_TOP;
--
2.25.0

Re: [PATCH] net: ena: ethtool: remove redundant non-zero check on rc

From: David Miller <davem@davemloft.net>
Date: 2020-02-24 00:41:58

From: Colin King <redacted>
Date: Fri, 21 Feb 2020 23:26:53 +0000
From: Colin Ian King <redacted>

The non-zero check on rc is redundant as a previous non-zero
check on rc will always return and the second check is never
reached, hence it is redundant and can be removed.  Also
remove a blank line.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <redacted>
Applied to net-next.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help