: bnx2: Fix uninitialized variable warning in bnx2_disable_forced_2g5()
Subsystems (2)
PATCH 1/1 : bnx2: Fix uninitialized variable warning in bnx2_disable_forced_2g5()
Fix warning:
drivers/net/bnx2.c: In function 'bnx2_disable_forced_2g5':drivers/net/bnx2.c:1489: warning: 'bmcr' may be used uninitialized in this function
drivers/net/bnx2.c +1 -1
@@ -1486,7 +1486,7 @@ bnx2_enable_forced_2g5(struct bnx2 *bp)static void bnx2_disable_forced_2g5 (struct bnx2 *bp) { -u32 bmcr; +u32 uninitialized_var (bmcr );if (!(bp->phy_flags &BNX2_PHY_FLAG_2_5G_CAPABLE ))return ;
David Miller
maintainerFrom: Prarit Bhargava <[email protected]>
Date: Thu, 27 May 2010 18:13:01 -0400
Quoted 6 lines
Fix warning:
drivers/net/bnx2.c: In function 'bnx2_disable_forced_2g5':drivers/net/bnx2.c:1489: warning: 'bmcr' may be used uninitialized in this functionSigned-off-by Prarit Bhargava <[email protected]>
This is another bad patch, you're hiding a bug by making this warning go away.
If bnx2_read_phy() in fact does not initialize "bmcr" we might want to do something about that instead of just blindly using whatever garbage is in that local variable.
Please stop making these patches without applying at least some intelligence to the analysis of why these warnings are being printed at all.
None of these cases you're posting patches for are situations where the compiler simply can't see the control flow properly, they are real issues.
Thanks.