pasemi_mac: ethtool get settings fix
authorValentine Barshak <vbarshak@ru.mvista.com>
Mon, 5 Oct 2009 03:27:56 +0000 (03:27 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Oct 2009 10:37:43 +0000 (03:37 -0700)
Not all pasemi mac interfaces can have a phy attached.
For example, XAUI has no phy and phydev is NULL for it.
In this case ethtool get settings causes kernel crash.
Fix it by returning -EOPNOTSUPP if there's no PHY attached.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pasemi_mac_ethtool.c

index 064a4fe1dd90efcee86a805ed6e94e1037385c2b..28a86224879db42187fae1adffcca056236b79b0 100644 (file)
@@ -71,6 +71,9 @@ pasemi_mac_ethtool_get_settings(struct net_device *netdev,
        struct pasemi_mac *mac = netdev_priv(netdev);
        struct phy_device *phydev = mac->phydev;
 
+       if (!phydev)
+               return -EOPNOTSUPP;
+
        return phy_ethtool_gset(phydev, cmd);
 }