diff mbox

[U-Boot,1/2] net: tsec: Fix NULL access in case init_phy() fails

Message ID 1386681665-6518-1-git-send-email-claudiu.manoil@freescale.com
State Accepted
Delegated to: Joe Hershberger
Headers show

Commit Message

Claudiu Manoil Dec. 10, 2013, 1:21 p.m. UTC
If the PHY is not recognized don't access phydev (NULL)
and return 0 to signal failure.

Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
---
 drivers/net/tsec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Joe Hershberger Jan. 30, 2015, 9:20 p.m. UTC | #1
On Tue, Dec 10, 2013 at 7:21 AM, Claudiu Manoil <
claudiu.manoil@freescale.com> wrote:
>
> If the PHY is not recognized don't access phydev (NULL)
> and return 0 to signal failure.
>
> Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
> ---

Applied, Thanks!
-Joe
diff mbox

Patch

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index e9138f0..65fb2b0 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -590,6 +590,8 @@  static int init_phy(struct eth_device *dev)
 		tsec_configure_serdes(priv);
 
 	phydev = phy_connect(priv->bus, priv->phyaddr, dev, priv->interface);
+	if (!phydev)
+		return 0;
 
 	phydev->supported &= supported;
 	phydev->advertising = phydev->supported;