netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: tg3: Use *_UNKNOWN ethtool definitions
@ 2012-02-17  6:48 Dan Carpenter
  2012-02-18  0:54 ` Matt Carlson
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-02-17  6:48 UTC (permalink / raw)
  To: mcarlson; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

Hello Matt Carlson,

The patch e740522e6d3a: "tg3: Use *_UNKNOWN ethtool definitions" from 
Feb 13, 2012, leads to the following Smatch warning:
drivers/net/ethernet/broadcom/tg3.c:1822 tg3_adjust_link()
	 error: tp->link_config.active_speed is never equal to -1 (wrong type 0 - 65535).

-       if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) ||
-           (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) ||
+       if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) ||
+           (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||

Since tp->link_config.active_speed is an unsigned short, it never is
equal to SPEED_UNKNOWN (-1).

I introduced the SPEED_UNKNOWN so I feel bad that it's causing trouble
now.  :/

Also this warning:
drivers/net/ethernet/broadcom/tg3.c:3909 tg3_phy_copper_begin(14)
error: tp->link_config.speed is never equal to -1 (wrong type 0 - 65535).

regards,
dan carpenter



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: tg3: Use *_UNKNOWN ethtool definitions
  2012-02-17  6:48 tg3: Use *_UNKNOWN ethtool definitions Dan Carpenter
@ 2012-02-18  0:54 ` Matt Carlson
  2012-02-18  1:03   ` Ben Hutchings
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Carlson @ 2012-02-18  0:54 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: mcarlson, netdev

On Fri, Feb 17, 2012 at 09:48:30AM +0300, Dan Carpenter wrote:
> Hello Matt Carlson,
> 
> The patch e740522e6d3a: "tg3: Use *_UNKNOWN ethtool definitions" from 
> Feb 13, 2012, leads to the following Smatch warning:
> drivers/net/ethernet/broadcom/tg3.c:1822 tg3_adjust_link()
> 	 error: tp->link_config.active_speed is never equal to -1 (wrong type 0 - 65535).
> 
> -       if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) ||
> -           (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) ||
> +       if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) ||
> +           (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||
> 
> Since tp->link_config.active_speed is an unsigned short, it never is
> equal to SPEED_UNKNOWN (-1).
> 
> I introduced the SPEED_UNKNOWN so I feel bad that it's causing trouble
> now.  :/
> 
> Also this warning:
> drivers/net/ethernet/broadcom/tg3.c:3909 tg3_phy_copper_begin(14)
> error: tp->link_config.speed is never equal to -1 (wrong type 0 - 65535).

Do you have any problems with changing SPEED_UNKNOWN from -1 to 0xffff?

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

* Re: tg3: Use *_UNKNOWN ethtool definitions
  2012-02-18  0:54 ` Matt Carlson
@ 2012-02-18  1:03   ` Ben Hutchings
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2012-02-18  1:03 UTC (permalink / raw)
  To: Matt Carlson; +Cc: Dan Carpenter, netdev

On Fri, 2012-02-17 at 16:54 -0800, Matt Carlson wrote:
> On Fri, Feb 17, 2012 at 09:48:30AM +0300, Dan Carpenter wrote:
> > Hello Matt Carlson,
> > 
> > The patch e740522e6d3a: "tg3: Use *_UNKNOWN ethtool definitions" from 
> > Feb 13, 2012, leads to the following Smatch warning:
> > drivers/net/ethernet/broadcom/tg3.c:1822 tg3_adjust_link()
> > 	 error: tp->link_config.active_speed is never equal to -1 (wrong type 0 - 65535).
> > 
> > -       if ((phydev->link && tp->link_config.active_speed == SPEED_INVALID) ||
> > -           (!phydev->link && tp->link_config.active_speed != SPEED_INVALID) ||
> > +       if ((phydev->link && tp->link_config.active_speed == SPEED_UNKNOWN) ||
> > +           (!phydev->link && tp->link_config.active_speed != SPEED_UNKNOWN) ||
> > 
> > Since tp->link_config.active_speed is an unsigned short, it never is
> > equal to SPEED_UNKNOWN (-1).
> > 
> > I introduced the SPEED_UNKNOWN so I feel bad that it's causing trouble
> > now.  :/
> > 
> > Also this warning:
> > drivers/net/ethernet/broadcom/tg3.c:3909 tg3_phy_copper_begin(14)
> > error: tp->link_config.speed is never equal to -1 (wrong type 0 - 65535).
> 
> Do you have any problems with changing SPEED_UNKNOWN from -1 to 0xffff?

I have a big problem with that - speed values are 32-bit in the ethtool
API.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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

end of thread, other threads:[~2012-02-18  1:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-17  6:48 tg3: Use *_UNKNOWN ethtool definitions Dan Carpenter
2012-02-18  0:54 ` Matt Carlson
2012-02-18  1:03   ` Ben Hutchings

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