Commit 00670cb8 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

net: dsa: Fix NULL checking in dsa_slave_set_eee()

This function can't succeed if dp->pl is NULL.  It will Oops inside the
call to return phylink_ethtool_get_eee(dp->pl, e);

Fixes: 1be52e97 ("dsa: slave: eee: Allow ports to use phylink")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2b1f86bf
...@@ -642,7 +642,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e) ...@@ -642,7 +642,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
int ret; int ret;
/* Port's PHY and MAC both need to be EEE capable */ /* Port's PHY and MAC both need to be EEE capable */
if (!dev->phydev && !dp->pl) if (!dev->phydev || !dp->pl)
return -ENODEV; return -ENODEV;
if (!ds->ops->set_mac_eee) if (!ds->ops->set_mac_eee)
...@@ -662,7 +662,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e) ...@@ -662,7 +662,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
int ret; int ret;
/* Port's PHY and MAC both need to be EEE capable */ /* Port's PHY and MAC both need to be EEE capable */
if (!dev->phydev && !dp->pl) if (!dev->phydev || !dp->pl)
return -ENODEV; return -ENODEV;
if (!ds->ops->get_mac_eee) if (!ds->ops->get_mac_eee)
......
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