bnx2: avoid compiler warnings
Subsystems (2)
PATCH 1/1 bnx2: avoid compiler warnings
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.
---
drivers/net/bnx2.c +4 -0
@@ -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 )
Quoted 6 lines · Eric Dumazet
drivers/net/bnx2.c: In function ‘bnx2_enable_forced_2g5’:drivers/net/bnx2.c:1447: warning: ‘bmcr’ may be used uninitialized in this functiondrivers/net/bnx2.c: In function ‘bnx2_disable_forced_2g5’:drivers/net/bnx2.c:1482: warning: ‘bmcr’ may be used uninitialized in this functionOne fix would be to have an initial value, but a plain return might be better.
I agree that plain return is better. Thanks.
Quoted 27 lines
Signed-off-by Eric Dumazet <[email protected]>---
drivers/net/bnx2.c +4
-0@@ -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 )
From: "Michael Chan" <[email protected]>
Date: Tue, 3 Nov 2009 10:01:34 -0800
Quoted 7 lines · Eric Dumazet
Quoted 5 lines
drivers/net/bnx2.c: In function ‘bnx2_enable_forced_2g5’:drivers/net/bnx2.c:1447: warning: ‘bmcr’ may be used uninitialized in this functiondrivers/net/bnx2.c: In function ‘bnx2_disable_forced_2g5’:drivers/net/bnx2.c:1482: warning: ‘bmcr’ may be used uninitialized in this function
Quoted 5 lines
Quoted 1 line
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 <[email protected]>
Applied, thanks.