liquidio: fix duplicated code for different branches

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>
This commit is contained in:
Gustavo A. R. Silva 2017-08-12 20:38:55 -05:00 committed by David S. Miller
parent da1542b01b
commit b5e7dc4742

View 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
return -EINVAL;
} else if (oct->chip_id == OCTEON_CN68XX) {
return -EINVAL;
} 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;