From patchwork Sat Jan 29 16:09:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 538468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2A9CC4332F for ; Sat, 29 Jan 2022 16:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233877AbiA2QR3 (ORCPT ); Sat, 29 Jan 2022 11:17:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243432AbiA2QR2 (ORCPT ); Sat, 29 Jan 2022 11:17:28 -0500 X-Greylist: delayed 458 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 29 Jan 2022 08:17:27 PST Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F03C061714 for ; Sat, 29 Jan 2022 08:17:27 -0800 (PST) Received: from dellmb.labs.office.nic.cz (unknown [IPv6:2001:1488:fffe:6:8747:7254:5571:3010]) by mail.nic.cz (Postfix) with ESMTPSA id B054914143F; Sat, 29 Jan 2022 17:09:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1643472587; bh=ONjZ2KS2CqJlj25di4iZrbBSPHJk26TeLebvrH0STU0=; h=From:To:Date; b=VPOj1ZqQtxmY3UkC4209joSY9Ys84yjCs96vO3yCneY1vOLyEed56vUTUGe/R8Y09 33rFeVhyYmCr00uiWygCaQOVpak9fetOiLdtd7rYNq7cQK8we0Hx3J5tzZjHGm82Fp APkHTVNqJM+gst8ZeZTVxx+5cMSFkKd62dQNfAAs= From: =?utf-8?q?Marek_Beh=C3=BAn?= To: gregkh@linuxfoundation.org Cc: stable@vger.kernel.org, kabel@kernel.org, "David S . Miller" Subject: [PATCH 5.4] net: sfp: ignore disabled SFP node Date: Sat, 29 Jan 2022 17:09:47 +0100 Message-Id: <20220129160947.11445-1-marek.behun@nic.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <164345764948199@kroah.com> References: MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at mail X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marek Behún 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 5.4 ] Signed-off-by: Marek Behún --- drivers/net/phy/phylink.c | 5 +++++ 1 file changed, 5 insertions(+) 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;