summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phylink.c
diff options
context:
space:
mode:
authorMarek Behún <kabel@kernel.org>2022-01-19 17:44:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-01 17:24:35 +0100
commitff19d70b665d43a90081b7a044e61db051e223cf (patch)
tree313fecd2016f7c9083278771c966c82eac716102 /drivers/net/phy/phylink.c
parent5ede72d48cab2d57c37c7e3e75b47459a8c0cbfa (diff)
downloadlinux-stable-ff19d70b665d43a90081b7a044e61db051e223cf.tar.gz
linux-stable-ff19d70b665d43a90081b7a044e61db051e223cf.tar.bz2
linux-stable-ff19d70b665d43a90081b7a044e61db051e223cf.zip
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 <kabel@kernel.org> Cc: stable@vger.kernel.org # 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer") Signed-off-by: David S. Miller <davem@davemloft.net> [ backport to 5.4 ] Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/phy/phylink.c')
-rw-r--r--drivers/net/phy/phylink.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 7be43a1eaefd..5b2bf7526903 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -582,6 +582,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, &sfp_phylink_ops);
if (!pl->sfp_bus)
return -ENOMEM;