]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: sfp: ignore disabled SFP node
authorMarek Behún <kabel@kernel.org>
Wed, 19 Jan 2022 16:44:55 +0000 (17:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jan 2022 11:53:01 +0000 (11:53 +0000)
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>
drivers/net/phy/sfp-bus.c

index 0c6c0d1843bce34023cb8211401f159a8c148619..c1512c9925a661c0853afd78d8da308c6318f514 100644 (file)
@@ -651,6 +651,11 @@ struct sfp_bus *sfp_bus_find_fwnode(struct fwnode_handle *fwnode)
        else if (ret < 0)
                return ERR_PTR(ret);
 
+       if (!fwnode_device_is_available(ref.fwnode)) {
+               fwnode_handle_put(ref.fwnode);
+               return NULL;
+       }
+
        bus = sfp_bus_get(ref.fwnode);
        fwnode_handle_put(ref.fwnode);
        if (!bus)