Skip to contentSkip to conversation

FAILED: patch "[PATCH] net: sfp: ignore disabled SFP node" failed to apply to 5.4-stable tree

PATCH In review [email protected] 2 participants 3 messages Jan 29, 2022

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 2148927e6ed43a1667baf7c2ae3e0e05a44b51a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <[email protected]>
Date: Wed, 19 Jan 2022 17:44:55 +0100
Subject: [PATCH] net: sfp: ignore disabled SFP node
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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")
Cc [email protected] # 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
drivers/net/phy/sfp-bus.c +5 -0
index 0c6c0d1843bc..c1512c9925a6 100644
@@ -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)
#1 lore raw

PATCH 1/1 net: sfp: ignore disabled SFP node

From: Marek Behún <[email protected]>

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")
Cc [email protected] # 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
[ backport to 5.4 ]
---
 drivers/net/phy/phylink.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/phy/phylink.c +5 -0
index 7be43a1eaefd..5b2bf7526903 100644
@@ -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;
Signature · 1 line
2.34.1
author maintainer
#2 lore raw

Re: [PATCH 5.4] net: sfp: ignore disabled SFP node

Quoted 18 lines · Marek Behún

From: Marek Behún <[email protected]>

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")
Cc [email protected] # 2203cbf2c8b5 ("net: sfp: move fwnode parsing into sfp-bus layer")
[ backport to 5.4 ]
Quoted 4 lines
---
 drivers/net/phy/phylink.c | 5 +++++
 1 file changed, 5 insertions(+)

All now queued up, thanks.

greg k-h