diff mbox

[net-2.6,1/3] ixgbe: Fix compiler warning about variable being used uninitialized

Message ID 20091212075120.10952.98484.stgit@localhost.localdomain
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Kirsher, Jeffrey T Dec. 12, 2009, 7:51 a.m. UTC
From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>

tc is still throwing a warning that is could be used
uninitialized.  This fixes it.

Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/ixgbe/ixgbe_main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Dec. 14, 2009, 3:20 a.m. UTC | #1
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 11 Dec 2009 23:51:23 -0800

> From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
> 
> tc is still throwing a warning that is could be used
> uninitialized.  This fixes it.
> 
> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

It's warning because it absolutely can be used uninitialized.

The two code blocks only handle two chip variants.  Why not
make what's happening here explicit by using a switch
statement and having a 'default' case?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Waskiewicz Jr, Peter P Dec. 14, 2009, 4:55 a.m. UTC | #2
On Sun, 2009-12-13 at 19:20 -0800, David Miller wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Fri, 11 Dec 2009 23:51:23 -0800
> 
> > From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
> > 
> > tc is still throwing a warning that is could be used
> > uninitialized.  This fixes it.
> > 
> > Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> 
> It's warning because it absolutely can be used uninitialized.
> 
> The two code blocks only handle two chip variants.  Why not
> make what's happening here explicit by using a switch
> statement and having a 'default' case?

That I can do, and makes more sense.  I'll respin the patch.

Thanks Dave,
-PJ

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 35ea8c9..d561fdf 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -258,7 +258,7 @@  static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
 
 #ifdef CONFIG_IXGBE_DCB
 	if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
-		int tc;
+		int tc = 0;
 		int reg_idx = tx_ring->reg_idx;
 		int dcb_i = adapter->ring_feature[RING_F_DCB].indices;