diff mbox

bnx2x: fix wrong return from bnx2x_trylock_hw_lock

Message ID 1282880943.2501.13.camel@edumazet-laptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Aug. 27, 2010, 3:49 a.m. UTC
bnx2x_trylock_hw_lock() returns a bool :

true if succeeded to acquire the lock.
false in case of error.

-EINVAL is not an acceptable value, since its promoted to true.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
Cosmetic patch, since compiler probably omits the code anyway.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eilon Greenstein Aug. 27, 2010, 4:54 a.m. UTC | #1
On Thu, 2010-08-26 at 20:49 -0700, Eric Dumazet wrote:
> bnx2x_trylock_hw_lock() returns a bool :
> 
> true if succeeded to acquire the lock.
> false in case of error.
> 
> -EINVAL is not an acceptable value, since its promoted to true.

Indeed - thanks Eric!

> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>

> ---
> Cosmetic patch, since compiler probably omits the code anyway.
> 
> diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
> index f8c3f08..86cc4b0 100644
> --- a/drivers/net/bnx2x/bnx2x_main.c
> +++ b/drivers/net/bnx2x/bnx2x_main.c
> @@ -781,7 +781,7 @@ static bool bnx2x_trylock_hw_lock(struct bnx2x *bp, u32 resource)
>  		DP(NETIF_MSG_HW,
>  		   "resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n",
>  		   resource, HW_LOCK_MAX_RESOURCE_VALUE);
> -		return -EINVAL;
> +		return false;
>  	}
>  
>  	if (func <= 5)
> 
> 
> 



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Aug. 27, 2010, 5:04 a.m. UTC | #2
From: "Eilon Greenstein" <eilong@broadcom.com>
Date: Fri, 27 Aug 2010 07:54:44 +0300

> On Thu, 2010-08-26 at 20:49 -0700, Eric Dumazet wrote:
>> bnx2x_trylock_hw_lock() returns a bool :
>> 
>> true if succeeded to acquire the lock.
>> false in case of error.
>> 
>> -EINVAL is not an acceptable value, since its promoted to true.
> 
> Indeed - thanks Eric!
> 
>> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Acked-by: Eilon Greenstein <eilong@broadcom.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Aug. 27, 2010, 5:07 a.m. UTC | #3
Le jeudi 26 août 2010 à 22:04 -0700, David Miller a écrit :

> Applied.

Thanks !

Wow, patchwork queue empty :)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index f8c3f08..86cc4b0 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -781,7 +781,7 @@  static bool bnx2x_trylock_hw_lock(struct bnx2x *bp, u32 resource)
 		DP(NETIF_MSG_HW,
 		   "resource(0x%x) > HW_LOCK_MAX_RESOURCE_VALUE(0x%x)\n",
 		   resource, HW_LOCK_MAX_RESOURCE_VALUE);
-		return -EINVAL;
+		return false;
 	}
 
 	if (func <= 5)