net: gem: Check if priv->phydev is valid
authorMichal Simek <michal.simek@xilinx.com>
Mon, 30 Nov 2015 13:03:37 +0000 (14:03 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 7 Dec 2015 08:59:05 +0000 (09:59 +0100)
Check return value.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
drivers/net/zynq_gem.c

index 86bb75905071667473203f12509169f272e82884..d5540ec2155c719d3c4a4a1e1f707734b8f034ee 100644 (file)
@@ -329,6 +329,8 @@ static int zynq_phy_init(struct eth_device *dev)
 
        priv->phydev = phy_connect(priv->bus, priv->phyaddr, dev,
                                   priv->interface);
+       if (!priv->phydev)
+               return -ENODEV;
 
        priv->phydev->supported = supported | ADVERTISED_Pause |
                                  ADVERTISED_Asym_Pause;