bonding: cleanup some redundant code and wrong variables
Subsystems (3)
PATCH 3/3 bonding: cleanup some redundant code and wrong variables
The dev_set_mac_address() will check the dev->netdev_ops->ndo_set_mac_address, so no need to check it in bond_set_mac_address().
Fix the wrong variables for pr_err().
--- drivers/net/bonding/bond_main.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/bonding/bond_main.c +1 -9
@@ -3509,15 +3509,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)*/ bond_for_each_slave (bond, slave, iter) { -const struct net_device_ops *slave_ops = slave->dev->netdev_ops;pr_debug ("slave %p %s\n" , slave, slave->dev->name); - -if (slave_ops->ndo_set_mac_address ==NULL ) { - res = -EOPNOTSUPP ; -pr_debug ("EOPNOTSUPP %s\n" , slave->dev->name); - goto unwind; - } - res =dev_set_mac_address (slave->dev, addr);if (res) {/* TODO: consider downing the slave
@@ -4317,7 +4309,7 @@ static int bond_check_params(struct bond_params *params) fail_over_mac_tbl);if (fail_over_mac_value ==-1 ) {pr_err ("Error: invalid fail_over_mac \"%s\"\n" , - arp_validate ==NULL ?"NULL" : arp_validate); + fail_over_mac ==NULL ?"NULL" : fail_over_mac);return -EINVAL ; }
Signature · 1 line
1.8.0
Quoted 34 lines · Ding Tianhong
The
dev_set_mac_address()will check thedev->netdev_ops->ndo_set_mac_address, so no need to check it inbond_set_mac_address().Fix the wrong variables for
pr_err().Cc Jay Vosburgh <[email protected]>Cc Veaceslav Falico <[email protected]>Cc Andy Gospodarek <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/net/bonding/bond_main.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/net/bonding/bond_main.c +0
-8@@ -3509,15 +3509,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)*/ bond_for_each_slave (bond, slave, iter) { -const struct net_device_ops *slave_ops = slave->dev->netdev_ops;pr_debug ("slave %p %s\n" , slave, slave->dev->name); - -if (slave_ops->ndo_set_mac_address ==NULL ) { - res = -EOPNOTSUPP ; -pr_debug ("EOPNOTSUPP %s\n" , slave->dev->name); - goto unwind; - } - res =dev_set_mac_address (slave->dev, addr);if (res) {/* TODO: consider downing the slave
drivers/net/bonding/bond_main.c static int bond_check_params(struct bond_params *params) · line 4314
Quoted 7 lines
drivers/net/bonding/bond_main.c +1
-1@@ -4317,7 +4309,7 @@ static int bond_check_params(struct bond_params *params) fail_over_mac_tbl);if (fail_over_mac_value ==-1 ) {pr_err ("Error: invalid fail_over_mac \"%s\"\n" , - arp_validate ==NULL ?"NULL" : arp_validate); + fail_over_mac ==NULL ?"NULL" : fail_over_mac);return -EINVAL ; }
My option API changes include a fix for this which also removes the NULL check as it's already checked earlier if fail_over_mac is != NULL. If you'd like to fix this yourself I think you can also skip the NULL check when printing the error.
Cheers,
Nik
Quoted 2 lines
Quoted 37 lines · Nikolay Aleksandrov
Quoted 36 lines · Ding Tianhong
The
dev_set_mac_address()will check thedev->netdev_ops->ndo_set_mac_address, so no need to check it inbond_set_mac_address().Fix the wrong variables for
pr_err().Cc Jay Vosburgh <[email protected]>Cc Veaceslav Falico <[email protected]>Cc Andy Gospodarek <[email protected]>Signed-off-by Ding Tianhong <[email protected]>--- drivers/net/bonding/bond_main.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/net/bonding/bond_main.c +0
-8@@ -3509,15 +3509,7 @@ static int bond_set_mac_address(struct net_device *bond_dev, void *addr)*/ bond_for_each_slave (bond, slave, iter) { -const struct net_device_ops *slave_ops = slave->dev->netdev_ops;pr_debug ("slave %p %s\n" , slave, slave->dev->name); - -if (slave_ops->ndo_set_mac_address ==NULL ) { - res = -EOPNOTSUPP ; -pr_debug ("EOPNOTSUPP %s\n" , slave->dev->name); - goto unwind; - } - res =dev_set_mac_address (slave->dev, addr);if (res) {/* TODO: consider downing the slave @@ -4317,7 +4309,7 @@ static int bond_check_params(struct bond_params *params) fail_over_mac_tbl);if (fail_over_mac_value ==-1 ) {
Quoted 9 lines
drivers/net/bonding/bond_main.c static int bond_check_params(struct bond_params *params) · line 4314
Quoted 5 lines
drivers/net/bonding/bond_main.c +1
-1pr_err ("Error: invalid fail_over_mac \"%s\"\n" , - arp_validate ==NULL ?"NULL" : arp_validate); + fail_over_mac ==NULL ?"NULL" : fail_over_mac);return -EINVAL ; }My option API changes include a fix for this which also removes the NULL check as it's already checked earlier if
fail_over_macis != NULL. If you'd like to fix this yourself I think you can also skip the NULL check when printing the error.
yes, it exist a long time, need to update. thanks.
Quoted 8 lines
Cheers,
NikQuoted 2 lines
.