Message ID | 20241004220206.7576-1-pvmohammedanees2003@gmail.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: dsa: Fix conditional handling of Wake-on-Lan configuration in dsa_user_set_wol | expand |
diff --git a/net/dsa/user.c b/net/dsa/user.c index 74eda9b30608..c685ccea9ddf 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1217,10 +1217,12 @@ static int dsa_user_set_wol(struct net_device *dev, struct ethtool_wolinfo *w) struct dsa_switch *ds = dp->ds; int ret = -EOPNOTSUPP; - phylink_ethtool_set_wol(dp->pl, w); - - if (ds->ops->set_wol) + if (ds->ops->set_wol) { ret = ds->ops->set_wol(ds, dp->index, w); + if (ret) + return ret; + phylink_ethtool_set_wol(dp->pl, w); + } return ret; }
The WOL configuration now checks if the DSA switch supports setting WOL before attempting to apply settings via phylink. This prevents unnecessary calls to phylink_ethtool_set_wol when WOL is not supported. Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com> --- net/dsa/user.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)