netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 3/3] bonding: cleanup some redundant code and wrong variables
@ 2014-01-22  9:22 Ding Tianhong
  2014-01-22 14:28 ` Nikolay Aleksandrov
  0 siblings, 1 reply; 3+ messages in thread
From: Ding Tianhong @ 2014-01-22  9:22 UTC (permalink / raw)
  To: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek, David S. Miller, Netdev

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().

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/bonding/bond_main.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ce0f5c0..9d92f46 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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;
 		}
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next 3/3] bonding: cleanup some redundant code and wrong variables
  2014-01-22  9:22 [PATCH net-next 3/3] bonding: cleanup some redundant code and wrong variables Ding Tianhong
@ 2014-01-22 14:28 ` Nikolay Aleksandrov
  2014-01-23  2:32   ` Ding Tianhong
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Aleksandrov @ 2014-01-22 14:28 UTC (permalink / raw)
  To: Ding Tianhong, Jay Vosburgh, Veaceslav Falico, Andy Gospodarek,
	David S. Miller, Netdev

On 01/22/2014 10:22 AM, Ding Tianhong wrote:
> 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().
> 
> Cc: Jay Vosburgh <fubar@us.ibm.com>
> Cc: Veaceslav Falico <vfalico@redhat.com>
> Cc: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  drivers/net/bonding/bond_main.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index ce0f5c0..9d92f46 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -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;
>  		}
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
>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next 3/3] bonding: cleanup some redundant code and wrong variables
  2014-01-22 14:28 ` Nikolay Aleksandrov
@ 2014-01-23  2:32   ` Ding Tianhong
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2014-01-23  2:32 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Jay Vosburgh, Veaceslav Falico,
	Andy Gospodarek, David S. Miller, Netdev

On 2014/1/22 22:28, Nikolay Aleksandrov wrote:
> On 01/22/2014 10:22 AM, Ding Tianhong wrote:
>> 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().
>>
>> Cc: Jay Vosburgh <fubar@us.ibm.com>
>> Cc: Veaceslav Falico <vfalico@redhat.com>
>> Cc: Andy Gospodarek <andy@greyhouse.net>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> ---
>>  drivers/net/bonding/bond_main.c | 10 +---------
>>  1 file changed, 1 insertion(+), 9 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index ce0f5c0..9d92f46 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -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;
>>  		}
> 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.
> 
yes, it exist a long time, need to update. thanks.

> Cheers,
>  Nik
>>  
>>
> 
> 
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-23  2:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-22  9:22 [PATCH net-next 3/3] bonding: cleanup some redundant code and wrong variables Ding Tianhong
2014-01-22 14:28 ` Nikolay Aleksandrov
2014-01-23  2:32   ` Ding Tianhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).