* [PATCH]: bnx2: Fix uninitialized variable warning in bnx2_disable_forced_2g5()
@ 2010-05-27 22:13 Prarit Bhargava
2010-05-27 23:26 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Prarit Bhargava @ 2010-05-27 22:13 UTC (permalink / raw)
To: netdev, mchan; +Cc: Prarit Bhargava
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
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 667f419..7e2f8ac 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH]: bnx2: Fix uninitialized variable warning in bnx2_disable_forced_2g5()
2010-05-27 22:13 [PATCH]: bnx2: Fix uninitialized variable warning in bnx2_disable_forced_2g5() Prarit Bhargava
@ 2010-05-27 23:26 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-05-27 23:26 UTC (permalink / raw)
To: prarit; +Cc: netdev, mchan
From: Prarit Bhargava <prarit@redhat.com>
Date: Thu, 27 May 2010 18:13:01 -0400
> 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
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-27 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 22:13 [PATCH]: bnx2: Fix uninitialized variable warning in bnx2_disable_forced_2g5() Prarit Bhargava
2010-05-27 23:26 ` 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).