Skip to contentSkip to conversation

net: macb: fix the building warning

PATCH New Bo Shen 2 participants 2 messages Aug 16, 2013 Network drivers

lore
Share & tools
lore

Bo Shen

author
#0 lore raw

PATCH 1/1 net: macb: fix the 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---

---
 drivers/net/macb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macb.c +1 -1
index 1f7cc32..90ae42d 100644
@@ -374,7 +374,7 @@ static int macb_phy_init(struct macb_device *macb)
 {
 	struct eth_device *netdev = &macb->netdev;
 #ifdef CONFIG_PHYLIB
-	struct phy_device *phydev;
+	struct phy_device *phydev = NULL;
 #endif
 	u32 ncfgr;
 	u16 phy_id, status, adv, lpa;
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 net: macb: fix the building warning

Hi Bo,

Quoted 18 lines · Bo Shen

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---

---
 drivers/net/macb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macb.c +0 -0
index 1f7cc32..90ae42d 100644

drivers/net/macb.c static int macb_phy_init(struct macb_device *macb) · line 377

Quoted 5 lines
drivers/net/macb.c +1 -1
@@ -374,7 +374,7 @@ static int macb_phy_init(struct macb_device *macb)
 {
 	struct eth_device *netdev = &macb->netdev;
 #ifdef CONFIG_PHYLIB
-	struct phy_device *phydev;
+	struct phy_device *phydev = NULL;

NAK, this will deference a NULL pointer later on ...

Best regards

Andreas Bie?mann