Commit 7b31c6a4 authored by Neil Armstrong's avatar Neil Armstrong Committed by Kleber Sacilotto de Souza

net: ethernet: davinci_emac: Fix devioctl while in fixed link

BugLink: https://bugs.launchpad.net/bugs/1878232

commit 62522ef3 upstream.

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: 1bb6aa56 ("net: davinci_emac: Add support for fixed-link PHY")
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Reviewed-by: default avatarMugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 8202ce62
...@@ -1512,7 +1512,10 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) ...@@ -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 */ /* 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) static int match_first_device(struct device *dev, void *data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment