* [PATCH] net: ena: ethtool: remove redundant non-zero check on rc
@ 2020-02-21 23:26 Colin King
2020-02-23 8:18 ` Jubran, Samih
2020-02-24 0:41 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2020-02-21 23:26 UTC (permalink / raw)
To: Netanel Belgazal, Arthur Kiyanovski, Guy Tzalik, Saeed Bishara,
Zorik Machulsky, David S . Miller, Sameeh Jubran, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] net: ena: ethtool: remove redundant non-zero check on rc
2020-02-21 23:26 [PATCH] net: ena: ethtool: remove redundant non-zero check on rc Colin King
@ 2020-02-23 8:18 ` Jubran, Samih
2020-02-24 0:41 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jubran, Samih @ 2020-02-23 8:18 UTC (permalink / raw)
To: Colin King, Belgazal, Netanel, Kiyanovski, Arthur, Tzalik, Guy,
Bshara, Saeed, Machulsky, Zorik, David S . Miller, netdev
Cc: kernel-janitors, linux-kernel
Ack, Thanks
> -----Original Message-----
> From: Colin King <colin.king@canonical.com>
> Sent: Saturday, February 22, 2020 1:27 AM
> To: Belgazal, Netanel <netanel@amazon.com>; Kiyanovski, Arthur
> <akiyano@amazon.com>; Tzalik, Guy <gtzalik@amazon.com>; Bshara, Saeed
> <saeedb@amazon.com>; Machulsky, Zorik <zorik@amazon.com>; David S .
> Miller <davem@davemloft.net>; Jubran, Samih <sameehj@amazon.com>;
> 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 <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: ena: ethtool: remove redundant non-zero check on rc
2020-02-21 23:26 [PATCH] net: ena: ethtool: remove redundant non-zero check on rc Colin King
2020-02-23 8:18 ` Jubran, Samih
@ 2020-02-24 0:41 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-02-24 0:41 UTC (permalink / raw)
To: colin.king
Cc: netanel, akiyano, gtzalik, saeedb, zorik, sameehj, netdev,
kernel-janitors, linux-kernel
From: Colin King <colin.king@canonical.com>
Date: Fri, 21 Feb 2020 23:26:53 +0000
> From: Colin Ian King <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
Applied to net-next.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-24 0:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 23:26 [PATCH] net: ena: ethtool: remove redundant non-zero check on rc Colin King
2020-02-23 8:18 ` Jubran, Samih
2020-02-24 0:41 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).