Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1561875 > unrolled thread

[PATCH 1/3] cxgb4: hide unused warnings

Started byArnd Bergmann <arnd@arndb.de>
First post2017-01-18 16:10 +0100
Last post2017-01-20 17:30 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] cxgb4: hide unused warnings Arnd Bergmann <arnd@arndb.de> - 2017-01-18 16:10 +0100
    [PATCH 3/3] bcm63xx_enet: avoid uninitialized variable warning Arnd Bergmann <arnd@arndb.de> - 2017-01-18 16:10 +0100
      Re: [PATCH 3/3] bcm63xx_enet: avoid uninitialized variable warning David Miller <davem@davemloft.net> - 2017-01-20 18:00 +0100
    Re: [PATCH 1/3] cxgb4: hide unused warnings David Miller <davem@davemloft.net> - 2017-01-20 17:30 +0100

#1561875 — [PATCH 1/3] cxgb4: hide unused warnings

FromArnd Bergmann <arnd@arndb.de>
Date2017-01-18 16:10 +0100
Subject[PATCH 1/3] cxgb4: hide unused warnings
Message-ID<t0ZSq-5mL-7@gated-at.bofh.it>
The two new variables are only used inside of an #ifdef and cause
harmless warnings when that is disabled:

drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: In function 'init_one':
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:4646:9: error: unused variable 'port_vec' [-Werror=unused-variable]
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:4646:6: error: unused variable 'v' [-Werror=unused-variable]

This adds another #ifdef around the declarations.

Fixes: 96fe11f27b70 ("cxgb4: Implement ndo_get_phys_port_id for mgmt dev")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 4da6f900ff24..49e000ebd2b9 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -4643,7 +4643,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	u32 whoami, pl_rev;
 	enum chip_type chip;
 	static int adap_idx = 1;
+#ifdef CONFIG_PCI_IOV
 	u32 v, port_vec;
+#endif
 
 	printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION);
 
-- 
2.9.0

[toc] | [next] | [standalone]


#1561879 — [PATCH 3/3] bcm63xx_enet: avoid uninitialized variable warning

FromArnd Bergmann <arnd@arndb.de>
Date2017-01-18 16:10 +0100
Subject[PATCH 3/3] bcm63xx_enet: avoid uninitialized variable warning
Message-ID<t1026-5Fi-33@gated-at.bofh.it>
In reply to#1561875
gcc-7 and probably earlier versions get confused by this function
and print a harmless warning:

drivers/net/ethernet/broadcom/bcm63xx_enet.c: In function 'bcm_enet_open':
drivers/net/ethernet/broadcom/bcm63xx_enet.c:1130:3: error: 'phydev' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This adds an initialization for the 'phydev' variable when it is unused
and changes the check to test for that NULL pointer to make it clear
that we always pass a valid pointer here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 1ad904680ca6..f0a0bcb31b7e 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -913,6 +913,8 @@ static int bcm_enet_open(struct net_device *dev)
 		priv->old_link = 0;
 		priv->old_duplex = -1;
 		priv->old_pause = -1;
+	} else {
+		phydev = NULL;
 	}
 
 	/* mask all interrupts and request them */
@@ -1083,7 +1085,7 @@ static int bcm_enet_open(struct net_device *dev)
 	enet_dmac_writel(priv, priv->dma_chan_int_mask,
 			 ENETDMAC_IRMASK, priv->tx_chan);
 
-	if (priv->has_phy)
+	if (phydev)
 		phy_start(phydev);
 	else
 		bcm_enet_adjust_link(dev);
@@ -1126,7 +1128,7 @@ static int bcm_enet_open(struct net_device *dev)
 	free_irq(dev->irq, dev);
 
 out_phy_disconnect:
-	if (priv->has_phy)
+	if (phydev)
 		phy_disconnect(phydev);
 
 	return ret;
-- 
2.9.0

[toc] | [prev] | [next] | [standalone]


#1563790 — Re: [PATCH 3/3] bcm63xx_enet: avoid uninitialized variable warning

FromDavid Miller <davem@davemloft.net>
Date2017-01-20 18:00 +0100
SubjectRe: [PATCH 3/3] bcm63xx_enet: avoid uninitialized variable warning
Message-ID<t1KHE-1gZ-23@gated-at.bofh.it>
In reply to#1561879
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 18 Jan 2017 15:52:53 +0100

> gcc-7 and probably earlier versions get confused by this function
> and print a harmless warning:
> 
> drivers/net/ethernet/broadcom/bcm63xx_enet.c: In function 'bcm_enet_open':
> drivers/net/ethernet/broadcom/bcm63xx_enet.c:1130:3: error: 'phydev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This adds an initialization for the 'phydev' variable when it is unused
> and changes the check to test for that NULL pointer to make it clear
> that we always pass a valid pointer here.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Also applied, thanks.

[toc] | [prev] | [next] | [standalone]


#1563750

FromDavid Miller <davem@davemloft.net>
Date2017-01-20 17:30 +0100
Message-ID<t1KeC-16c-5@gated-at.bofh.it>
In reply to#1561875
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 18 Jan 2017 15:52:51 +0100

> The two new variables are only used inside of an #ifdef and cause
> harmless warnings when that is disabled:
> 
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c: In function 'init_one':
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:4646:9: error: unused variable 'port_vec' [-Werror=unused-variable]
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c:4646:6: error: unused variable 'v' [-Werror=unused-variable]
> 
> This adds another #ifdef around the declarations.
> 
> Fixes: 96fe11f27b70 ("cxgb4: Implement ndo_get_phys_port_id for mgmt dev")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web