Patch "bcm63xx_enet: avoid uninitialized variable warning" has been added to the 4.9-stable tree
From: <gregkh@linuxfoundation.org>
Date: 2017-03-15 07:25:50
This is a note to let you know that I've just added the patch titled
bcm63xx_enet: avoid uninitialized variable warning
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
bcm63xx_enet-avoid-uninitialized-variable-warning.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let [off-list ref] know about it.
From df384d435a5c034c735df3d9ea87a03172c59b56 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de> Date: Wed, 18 Jan 2017 15:52:53 +0100 Subject: bcm63xx_enet: avoid uninitialized variable warning From: Arnd Bergmann <arnd@arndb.de> commit df384d435a5c034c735df3d9ea87a03172c59b56 upstream. 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> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
--- 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_devi 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_devi 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 @@ out_freeirq: free_irq(dev->irq, dev); out_phy_disconnect: - if (priv->has_phy) + if (phydev) phy_disconnect(phydev); return ret;
Patches currently in stable-queue which might be from arnd@arndb.de are queue-4.9/mips-ip27-disable-qlge-driver-in-defconfig.patch queue-4.9/bcm63xx_enet-avoid-uninitialized-variable-warning.patch queue-4.9/mips-update-ip27_defconfig-for-scsi_dh-change.patch queue-4.9/mtd-pmcmsp-use-kstrndup-instead-of-kmalloc-strncpy.patch queue-4.9/cpmac-remove-hopeless-warning.patch queue-4.9/mips-vdso-avoid-duplicate-cac_base-definition.patch queue-4.9/mips-ip22-fix-ip28-build-for-modern-gcc.patch queue-4.9/mips-update-lemote2f_defconfig-for-cpu_freq_stat-change.patch queue-4.9/crypto-improve-gcc-optimization-flags-for-serpent-and-wp512.patch queue-4.9/mips-ralink-remove-unused-rt-_wdt_reset-functions.patch queue-4.9/mips-ralink-remove-unused-timer-functions.patch queue-4.9/mips-update-defconfigs-for-nf_ct_proto_dccp-udplite-change.patch