From: Marek Behún Date: Wed, 19 Jan 2022 16:44:55 +0000 (+0100) Subject: net: sfp: ignore disabled SFP node X-Git-Tag: v4.19.228~69 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f5b894aedbf6065faa0dda0518e197ae73168257;p=users%2Fdwmw2%2Flinux.git net: sfp: ignore disabled SFP node commit 2148927e6ed43a1667baf7c2ae3e0e05a44b51a0 upstream. Commit ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages") added code which finds SFP bus DT node even if the node is disabled with status = "disabled". Because of this, when phylink is created, it ends with non-null .sfp_bus member, even though the SFP module is not probed (because the node is disabled). We need to ignore disabled SFP bus node. Fixes: ce0aa27ff3f6 ("sfp: add sfp-bus to bridge between network devices and sfp cages") Signed-off-by: Marek Behún Cc: stable@vger.kernel.org # 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer") Signed-off-by: David S. Miller [ backport to 4.19 ] Signed-off-by: Marek Behún Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index e808efd762122..e0e175c691d45 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -554,6 +554,11 @@ static int phylink_register_sfp(struct phylink *pl, return ret; } + if (!fwnode_device_is_available(ref.fwnode)) { + fwnode_handle_put(ref.fwnode); + return 0; + } + pl->sfp_bus = sfp_register_upstream(ref.fwnode, pl->netdev, pl, &sfp_phylink_ops); if (!pl->sfp_bus)