[PATCH net v1] lan743x: fix use of uninitialized variable

From: Sven Van Asbroeck
Date: Thu Nov 12 2020 - 10:25:22 EST


From: Sven Van Asbroeck <thesven73@xxxxxxxxx>

When no devicetree is present, the driver will use an
uninitialized variable.

Fix by initializing this variable.

Fixes: 902a66e08cea ("lan743x: correctly handle chips with internal PHY")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Sven Van Asbroeck <thesven73@xxxxxxxxx>
---
Tree: git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git # 52755b66ddce

To: Jakub Kicinski <kuba@xxxxxxxxxx>
To: Bryan Whitehead <bryan.whitehead@xxxxxxxxxxxxx>
To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Cc: Microchip Linux Driver Support <UNGLinuxDriver@xxxxxxxxxxxxx>
Cc: Andrew Lunn <andrew@xxxxxxx>
Cc: netdev@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx

drivers/net/ethernet/microchip/lan743x_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 54d721ef3084..0c9b938ee0ea 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1014,8 +1014,8 @@ static void lan743x_phy_close(struct lan743x_adapter *adapter)
static int lan743x_phy_open(struct lan743x_adapter *adapter)
{
struct lan743x_phy *phy = &adapter->phy;
+ struct phy_device *phydev = NULL;
struct device_node *phynode;
- struct phy_device *phydev;
struct net_device *netdev;
int ret = -EIO;

--
2.17.1