netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] cxgb4: Fix static checker warnings
@ 2014-07-15 19:17 Anish Bhatt
  2014-07-15 21:57 ` Casey Leedom
  2014-07-16 22:45 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Anish Bhatt @ 2014-07-15 19:17 UTC (permalink / raw)
  To: netdev; +Cc: davem, leedom, hariprasad, dan.carpenter, Anish Bhatt

This patch fixes static checker warnings as pointed out on by Dan Carpenter

Fixes: 76bcb31efc06 ("cxgb4 : Add DCBx support codebase  and dcbnl_ops")
Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
index a8b1073e6373..8734dfe0da32 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
@@ -676,15 +676,15 @@ static u8 cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
 
 
 	if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
-		return -EINVAL;
+		return 0;
 
 	/* DCB info gets thrown away on link up */
 	if (!netif_carrier_ok(dev))
-		return -ENOLINK;
+		return 0;
 
 	if (app_idtype != DCB_APP_IDTYPE_ETHTYPE &&
 	    app_idtype != DCB_APP_IDTYPE_PORTNUM)
-		return -EINVAL;
+		return 0;
 
 	for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) {
 		INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id);
@@ -710,7 +710,7 @@ static u8 cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
 	if (i == CXGB4_MAX_DCBX_APP_SUPPORTED) {
 		/* no empty slots available */
 		dev_err(adap->pdev_dev, "DCB app table full\n");
-		return -EBUSY;
+		return 0;
 	}
 
 	/* write out new app table entry */
-- 
2.0.1

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

* Re: [PATCH net-next] cxgb4: Fix static checker warnings
  2014-07-15 19:17 [PATCH net-next] cxgb4: Fix static checker warnings Anish Bhatt
@ 2014-07-15 21:57 ` Casey Leedom
  2014-07-16 22:45 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Casey Leedom @ 2014-07-15 21:57 UTC (permalink / raw)
  To: Anish Bhatt, netdev; +Cc: davem, hariprasad, dan.carpenter

   While it's great to fix these warnings, it seems like this might be 
going in the wrong direction.

   Currently only the cxgb4 and bnx2x drivers offer (struct 
dcbnl_rtnl_ops).setapp() calls.  The bnx2x driver also returns -EINVAL, 
etc.  Meanwhile, the only call to the .setapp() entry is in 
dcbnl_setapp() and it stores the result back into an int "ret".  It 
strikes me that the real bug may be an incorrect "u8" return type for 
the .setapp() prototype in include/net/dcbnl.h.  The prototype was added 
in commit 7114323b almost 5 years ago so I'm not sure if the original 
author, Yi Zou <yi.zou@intel.com>, will be around to offer backing 
information on this ...

Casey

On 07/15/14 12:17, Anish Bhatt wrote:
> This patch fixes static checker warnings as pointed out on by Dan Carpenter
>
> Fixes: 76bcb31efc06 ("cxgb4 : Add DCBx support codebase  and dcbnl_ops")
> Signed-off-by: Anish Bhatt <anish@chelsio.com>
> ---
>   drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
> index a8b1073e6373..8734dfe0da32 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
> @@ -676,15 +676,15 @@ static u8 cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
>   
>   
>   	if (pi->dcb.state != CXGB4_DCB_STATE_FW_ALLSYNCED)
> -		return -EINVAL;
> +		return 0;
>   
>   	/* DCB info gets thrown away on link up */
>   	if (!netif_carrier_ok(dev))
> -		return -ENOLINK;
> +		return 0;
>   
>   	if (app_idtype != DCB_APP_IDTYPE_ETHTYPE &&
>   	    app_idtype != DCB_APP_IDTYPE_PORTNUM)
> -		return -EINVAL;
> +		return 0;
>   
>   	for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) {
>   		INIT_PORT_DCB_READ_LOCAL_CMD(pcmd, pi->port_id);
> @@ -710,7 +710,7 @@ static u8 cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
>   	if (i == CXGB4_MAX_DCBX_APP_SUPPORTED) {
>   		/* no empty slots available */
>   		dev_err(adap->pdev_dev, "DCB app table full\n");
> -		return -EBUSY;
> +		return 0;
>   	}
>   
>   	/* write out new app table entry */

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

* Re: [PATCH net-next] cxgb4: Fix static checker warnings
  2014-07-15 19:17 [PATCH net-next] cxgb4: Fix static checker warnings Anish Bhatt
  2014-07-15 21:57 ` Casey Leedom
@ 2014-07-16 22:45 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-07-16 22:45 UTC (permalink / raw)
  To: anish; +Cc: netdev, leedom, hariprasad, dan.carpenter

From: Anish Bhatt <anish@chelsio.com>
Date: Tue, 15 Jul 2014 12:17:23 -0700

> This patch fixes static checker warnings as pointed out on by Dan Carpenter
> 
> Fixes: 76bcb31efc06 ("cxgb4 : Add DCBx support codebase  and dcbnl_ops")
> Signed-off-by: Anish Bhatt <anish@chelsio.com>

The real bug here is more likely, as Casey Leedom said, that the method
returns u8 instead of int.

The only other implementation of this method, bnx2x, also tries to return
negative error codes.

So please just change the return type in the method signature and the
two implementations.

Thanks.

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

end of thread, other threads:[~2014-07-16 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15 19:17 [PATCH net-next] cxgb4: Fix static checker warnings Anish Bhatt
2014-07-15 21:57 ` Casey Leedom
2014-07-16 22:45 ` David Miller

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