From: Bo Shen Date: Mon, 19 Aug 2013 02:35:47 +0000 (+0800) Subject: net: macb: fix the following building warning X-Git-Tag: v2013.10-rc3~5^2~7^2~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8314ccd8d4fe36abab034260ee66cd8c2b6de39b;p=oweals%2Fu-boot.git net: macb: fix the following building warning fix the following building warning ---8>--- macb.c: In function 'macb_init': macb.c:400:14: warning: 'phydev' may be used uninitialized in this function macb.c:377:21: note: 'phydev' was declared here ---<8--- Signed-off-by: Bo Shen Signed-off-by: Andreas Bießmann --- diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 1f7cc322e0..bf3983a00c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "macb.h" @@ -397,9 +398,14 @@ static int macb_phy_init(struct macb_device *macb) } #ifdef CONFIG_PHYLIB - phydev->bus = macb->bus; - phydev->dev = netdev; - phydev->addr = macb->phy_addr; + /* need to consider other phy interface mode */ + phydev = phy_connect(macb->bus, macb->phy_addr, netdev, + PHY_INTERFACE_MODE_RGMII); + if (!phydev) { + printf("phy_connect failed\n"); + return -ENODEV; + } + phy_config(phydev); #endif