All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] bnx2: avoid compiler warnings
@ 2009-11-03  9:17 Eric Dumazet
  2009-11-03 18:01 ` Michael Chan
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2009-11-03  9:17 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List, Michael Chan

drivers/net/bnx2.c: In function ‘bnx2_enable_forced_2g5’:
drivers/net/bnx2.c:1447: warning: ‘bmcr’ may be used uninitialized in this function
drivers/net/bnx2.c: In function ‘bnx2_disable_forced_2g5’:
drivers/net/bnx2.c:1482: warning: ‘bmcr’ may be used uninitialized in this function

One fix would be to have an initial value, but a plain return might be better.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 08cddb6..539d23b 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1466,6 +1466,8 @@ bnx2_enable_forced_2g5(struct bnx2 *bp)
 	} else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
 		bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
 		bmcr |= BCM5708S_BMCR_FORCE_2500;
+	} else {
+		return;
 	}
 
 	if (bp->autoneg & AUTONEG_SPEED) {
@@ -1500,6 +1502,8 @@ bnx2_disable_forced_2g5(struct bnx2 *bp)
 	} else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
 		bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
 		bmcr &= ~BCM5708S_BMCR_FORCE_2500;
+	} else {
+		return;
 	}
 
 	if (bp->autoneg & AUTONEG_SPEED)

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

* Re: [PATCH net-next-2.6] bnx2: avoid compiler warnings
  2009-11-03  9:17 [PATCH net-next-2.6] bnx2: avoid compiler warnings Eric Dumazet
@ 2009-11-03 18:01 ` Michael Chan
  2009-11-04 13:08   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Chan @ 2009-11-03 18:01 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List


On Tue, 2009-11-03 at 01:17 -0800, Eric Dumazet wrote:
> drivers/net/bnx2.c: In function ‘bnx2_enable_forced_2g5’:
> drivers/net/bnx2.c:1447: warning: ‘bmcr’ may be used uninitialized in this function
> drivers/net/bnx2.c: In function ‘bnx2_disable_forced_2g5’:
> drivers/net/bnx2.c:1482: warning: ‘bmcr’ may be used uninitialized in this function
> 
> One fix would be to have an initial value, but a plain return might be better.

I agree that plain return is better.  Thanks.

Acked-by: Michael Chan <mchan@broadcom.com>

> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> 
> diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
> index 08cddb6..539d23b 100644
> --- a/drivers/net/bnx2.c
> +++ b/drivers/net/bnx2.c
> @@ -1466,6 +1466,8 @@ bnx2_enable_forced_2g5(struct bnx2 *bp)
>  	} else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
>  		bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
>  		bmcr |= BCM5708S_BMCR_FORCE_2500;
> +	} else {
> +		return;
>  	}
>  
>  	if (bp->autoneg & AUTONEG_SPEED) {
> @@ -1500,6 +1502,8 @@ bnx2_disable_forced_2g5(struct bnx2 *bp)
>  	} else if (CHIP_NUM(bp) == CHIP_NUM_5708) {
>  		bnx2_read_phy(bp, bp->mii_bmcr, &bmcr);
>  		bmcr &= ~BCM5708S_BMCR_FORCE_2500;
> +	} else {
> +		return;
>  	}
>  
>  	if (bp->autoneg & AUTONEG_SPEED)
> 



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

* Re: [PATCH net-next-2.6] bnx2: avoid compiler warnings
  2009-11-03 18:01 ` Michael Chan
@ 2009-11-04 13:08   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-11-04 13:08 UTC (permalink / raw)
  To: mchan; +Cc: eric.dumazet, netdev

From: "Michael Chan" <mchan@broadcom.com>
Date: Tue, 3 Nov 2009 10:01:34 -0800

> 
> On Tue, 2009-11-03 at 01:17 -0800, Eric Dumazet wrote:
>> drivers/net/bnx2.c: In function ‘bnx2_enable_forced_2g5’:
>> drivers/net/bnx2.c:1447: warning: ‘bmcr’ may be used uninitialized in this function
>> drivers/net/bnx2.c: In function ‘bnx2_disable_forced_2g5’:
>> drivers/net/bnx2.c:1482: warning: ‘bmcr’ may be used uninitialized in this function
>> 
>> One fix would be to have an initial value, but a plain return might be better.
> 
> I agree that plain return is better.  Thanks.
> 
> Acked-by: Michael Chan <mchan@broadcom.com>

Applied, thanks.

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

end of thread, other threads:[~2009-11-04 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03  9:17 [PATCH net-next-2.6] bnx2: avoid compiler warnings Eric Dumazet
2009-11-03 18:01 ` Michael Chan
2009-11-04 13:08   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.