Thread (2 messages) 2 messages, 2 authors, 2016-07-30

Re: [PATCH net-next 01/10] drivers: net: xgene: Fix kbuild warning

From: Arnd Bergmann <arnd@arndb.de>
Date: 2016-07-30 09:13:17
Also in: linux-arm-kernel, linux-devicetree
Subsystem: applied micro (apm) x-gene soc ethernet driver, networking drivers, the rest · Maintainers: Iyappan Subramanian, Keyur Chudgar, Quan Nguyen, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

On Friday, July 29, 2016 5:33:54 PM CEST Iyappan Subramanian wrote:
This patch fixes the following kbuild warning, when ACPI was not enabled.
quoted
quoted
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:878:23: warning: 'phy_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
     phy_dev->advertising = phy_dev->supported;
From looking at the patch, I don't think it addresses the warning.
Note that Linus added a patch to disable the warning in the latest
mainline kernel, so you won't see it any more, but I think the bug
is still there.
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d..b6bc6fa 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -776,15 +776,11 @@ int xgene_enet_phy_connect(struct net_device *ndev)
                        netdev_err(ndev, "Could not connect to PHY\n");
                        return -ENODEV;
                }
-
-               pdata->phy_dev = phy_dev;
        } else {
 #ifdef CONFIG_ACPI
                struct acpi_device *adev = acpi_phy_find_device(dev);
                if (adev)
-                       pdata->phy_dev =  adev->driver_data;
-
-               phy_dev = pdata->phy_dev;
+                       phy_dev =  adev->driver_data;
 
                if (!phy_dev ||
                    phy_connect_direct(ndev, phy_dev, &xgene_enet_adjust_link,
@@ -795,6 +791,7 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 #endif
        }
 
+       pdata->phy_dev = phy_dev;
phy_dev is not initialized anywhere if CONFIG_ACPI is not set
and dev->of_node is NULL (which should not happen in practice,
but the compiler doesn't know that).

I think you want this instead:
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 7714b7d4026a..98779fe2d558 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -792,6 +792,8 @@ int xgene_enet_phy_connect(struct net_device *ndev)
 			netdev_err(ndev, "Could not connect to PHY\n");
 			return  -ENODEV;
 		}
+#else
+		return -ENODEV;
 #endif
 	}
 
	ARnd

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help