liquidio: fix duplicated code for different branches
Subsystems (3)
PATCH 1/1 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 <[email protected]>
---
This code was tested by compilation only.
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +3 -8
@@ -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 ;
Signature · 1 line
2.5.0
Quoted 45 lines · Gustavo A. R. Silva
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 <[email protected]>---
This code was tested by compilation only.drivers/net/ethernet/cavium/liquidio/lio_ethtool.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/net/ethernet/cavium/liquidio/lio_ethtool.c +3
-8@@ -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 ;Signature · 1 line
2.5.0
Acked-by Felix Manlunas <[email protected]>
From: "Gustavo A. R. Silva" <[email protected]>
Date: Sat, 12 Aug 2017 20:38:55 -0500
Quoted 5 lines
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 <[email protected]>
Applied.