Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1710415 > unrolled thread

[PATCH] liquidio: fix duplicated code for different branches

Started by"Gustavo A. R. Silva" <gustavo@embeddedor.com>
First post2017-08-13 03:40 +0200
Last post2017-08-14 20:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] liquidio: fix duplicated code for different branches "Gustavo A. R. Silva" <gustavo@embeddedor.com> - 2017-08-13 03:40 +0200
    Re: [PATCH] liquidio: fix duplicated code for different branches David Miller <davem@davemloft.net> - 2017-08-14 20:00 +0200

#1710415 — [PATCH] liquidio: fix duplicated code for different branches

From"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date2017-08-13 03:40 +0200
Subject[PATCH] liquidio: fix duplicated code for different branches
Message-ID<udQ2J-lH-7@gated-at.bofh.it>
Refactor code in order to avoid identical code for different branches.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
This code was tested by compilation only.

 drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
index b78e296..4f65c08 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
@@ -578,23 +578,18 @@ static int lio_set_phys_id(struct net_device *netdev,
 		break;
 
 	case ETHTOOL_ID_ON:
-		if (oct->chip_id == OCTEON_CN66XX) {
+		if (oct->chip_id == OCTEON_CN66XX)
 			octnet_gpio_access(netdev, VITESSE_PHY_GPIO_CFG,
 					   VITESSE_PHY_GPIO_HIGH);
-
-		} else if (oct->chip_id == OCTEON_CN68XX) {
-			return -EINVAL;
-		} else {
+		else
 			return -EINVAL;
-		}
+
 		break;
 
 	case ETHTOOL_ID_OFF:
 		if (oct->chip_id == OCTEON_CN66XX)
 			octnet_gpio_access(netdev, VITESSE_PHY_GPIO_CFG,
 					   VITESSE_PHY_GPIO_LOW);
-		else if (oct->chip_id == OCTEON_CN68XX)
-			return -EINVAL;
 		else
 			return -EINVAL;
 
-- 
2.5.0

[toc] | [next] | [standalone]


#1711299

FromDavid Miller <davem@davemloft.net>
Date2017-08-14 20:00 +0200
Message-ID<uerOF-79Q-5@gated-at.bofh.it>
In reply to#1710415
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Sat, 12 Aug 2017 20:38:55 -0500

> Refactor code in order to avoid identical code for different branches.
> 
> This issue was detected with the help of Coccinelle.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web