Skip to content

Commit

Permalink
net: ethernet: davinci_emac: Fix devioctl while in fixed link
Browse files Browse the repository at this point in the history
When configured in fixed link, the DaVinci emac driver sets the
priv->phydev to NULL and further ioctl calls to the phy_mii_ioctl()
causes the kernel to crash.

Cc: Brian Hutchinson <b.hutchman@gmail.com>
Fixes: 1bb6aa5 ("net: davinci_emac: Add support for fixed-link PHY")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Neil Armstrong authored and David S. Miller committed Apr 28, 2016
1 parent eee66af commit 62522ef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/ti/davinci_emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd)

/* TODO: Add phy read and write and private statistics get feature */

return phy_mii_ioctl(priv->phydev, ifrq, cmd);
if (priv->phydev)
return phy_mii_ioctl(priv->phydev, ifrq, cmd);
else
return -EOPNOTSUPP;
}

static int match_first_device(struct device *dev, void *data)
Expand Down

0 comments on commit 62522ef

Please sign in to comment.