diff mbox series

[net] net: sfp: ignore disabled SFP node

Message ID 20220119164455.1397-1-kabel@kernel.org (mailing list archive)
State Accepted
Commit 2148927e6ed43a1667baf7c2ae3e0e05a44b51a0
Delegated to: Netdev Maintainers
Headers show
Series [net] net: sfp: ignore disabled SFP node | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers fail 1 blamed authors not CCed: linux@armlinux.org.uk; 3 maintainers not CCed: hkallweit1@gmail.com kuba@kernel.org linux@armlinux.org.uk
netdev/build_clang success Errors and warnings before: 22 this patch: 22
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marek Behún Jan. 19, 2022, 4:44 p.m. UTC
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")
---
 drivers/net/phy/sfp-bus.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

patchwork-bot+netdevbpf@kernel.org Jan. 24, 2022, noon UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 19 Jan 2022 17:44:55 +0100 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net: sfp: ignore disabled SFP node
    https://git.kernel.org/netdev/net/c/2148927e6ed4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index 0c6c0d1843bc..c1512c9925a6 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -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)