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: 538469 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 7E4ABC433F5 for ; Sat, 29 Jan 2022 16:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345971AbiA2QR2 (ORCPT ); Sat, 29 Jan 2022 11:17:28 -0500 Received: from mail.nic.cz ([217.31.204.67]:35078 "EHLO mail.nic.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230389AbiA2QR1 (ORCPT ); Sat, 29 Jan 2022 11:17:27 -0500 X-Greylist: delayed 460 seconds by postgrey-1.27 at vger.kernel.org; Sat, 29 Jan 2022 11:17:27 EST 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 5D0F5140E6F; 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=aUNm+Q/v85IjFc2S1GiiNapGqLz5nUN2KQIelrzx+aE=; h=From:To:Date; b=hZySHg9q3GECRE77nFNbwyWVMMogT1uSJeIWfm/o/Xv0qHHeqT4Ifi82H8u/fvIpx KPQcHm9ksUaKFFHASBHEHBQZHT07y8uqYjCnMsSx8LNexPAmiOi5zLQrfWpdvqSyNe IIuGAMJ0zimq/ceVcVToeEIwJ1VWK+hrXLTD2sQk= 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 4.19] net: sfp: ignore disabled SFP node Date: Sat, 29 Jan 2022 17:09:47 +0100 Message-Id: <20220129160947.11434-1-marek.behun@nic.cz> X-Mailer: git-send-email 2.34.1 In-Reply-To: <16434576496299@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 4.19 ] 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 e808efd76212..e0e175c691d4 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -554,6 +554,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->netdev, pl, &sfp_phylink_ops); if (!pl->sfp_bus)