liquidio: fix duplicated code for different branches
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Sun, 13 Aug 2017 01:38:55 +0000 (20:38 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Aug 2017 17:58:09 +0000 (10:58 -0700)
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>
Acked-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c

index b78e296c4cba98ee8938e7acfe613475be7352f7..4f65c08461f694b37223b4ddbeee9dd8939f0b7a 100644 (file)
@@ -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;