Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2894920pxb; Tue, 24 Aug 2021 10:03:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYs+bOaa2Kl8I6ieonNRCi6aSkokid8cKbL+D4PznY4bxZaAwoAWcLxnOwCgyYFUimjyv1 X-Received: by 2002:a05:6512:314b:: with SMTP id s11mr293416lfi.442.1629824627947; Tue, 24 Aug 2021 10:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824627; cv=none; d=google.com; s=arc-20160816; b=v3VUxzkmJIGD1Ju9BuX96YZqIZlO7yl5FYOhbGX0UEJjk+TgtXNSv5Lo0imGa24wM9 uooIH+t1gbTlF8YQNEw4z9wii+dhB4FgUd9rNzqLwdfpsN009UGjUHmt515imsT7kiOJ MdD/OUD8vqoiFiFimaN21jWpEumb35247zrsRSCGhTkCBiHjLLdBt8+x01sKPC0pjcAF joQc98wxkSBGgeRPgMLX5GAMFmXY9hCzpkAaE3VgwCVVn++HOIVP4Jw+2ibMtd3knool C8QoQpm9YKR2FCwzvPgKUxfdX8REGVdwon9KcLf6WEdY2Ltg9E6UtX1CtHtBdQCNgJEc rz9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mDoB/yEnZU59Hn3qF5PiFxiE+4QvP3wsN6RxedS/zRQ=; b=zKDqRS2M51Iw6Ie9JZrLXzHH7fSGQeoJ1jNQnDunwNm0cwf84sKywW6sGDmOR2D2K8 86UXuQRw/8Ii7IAOzoXQhSZZ7PkxFKnHZeamKy6BIBYjeJPM98rmwtfltV+2uDPJIRkK 6kaZMDAeNfhDK11v6RtA2tUPxE2Bflg20uYsiSz5mWIGoagpG3nLdgU5ULq/K0YcqaUz MsteW24pQAqQAh6/1K9/YJz6akFStI8N4z2Y2RiarlmFcc7fkrxEFBsKkl6pwG9/w8ty /WGpiOIZg87GhDMUIDMYCdRF2WCFuXID5n414qN60qt03MXA8h+SCvoHB+prr0qU/bdp ERzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iQyVJRrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du10si5835931ejc.547.2021.08.24.10.03.12; Tue, 24 Aug 2021 10:03:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iQyVJRrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238891AbhHXRBR (ORCPT + 99 others); Tue, 24 Aug 2021 13:01:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:39904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235000AbhHXQ6O (ORCPT ); Tue, 24 Aug 2021 12:58:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B6955613B1; Tue, 24 Aug 2021 16:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824234; bh=EwT0B2S1XgskTufYh5xi7N7TyU/h3WjAGvHnXhoS3f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQyVJRrUczX4IIBhic3sI/sXW/nVq3CMXJ+c2ORjiged2CF8zsdwSAaGQRazVtkvx IuFaju4+h0pBCYGzBRzwgD6GCy0PKU4FAj/W2n+F4SMMMr8PHMh0+caLS2FhA35l5o oG/vduA6CZ8vFon3mwAMqSpou3UboUCDky9ai9ycn3pwPdqcmIulWKSHmyB02Z+Plq AUT8nQAM1bE8EdWxQDZVFnG66AnO1vLnQWIADt7+cMvvkCOCLY0KFuDuKks+h8M0bw b6Tv+DU3F8JwObVep1kAyyVDY8mGw8HbTf6NI1L1hTOe3OzoEsXq+bO8hkq0Ir5Mv2 bB4uMFkpV3T3w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Saravana Kannan , Andrew Lunn , Marc Zyngier , Kevin Hilman , "David S . Miller" , Sasha Levin Subject: [PATCH 5.13 067/127] net: mdio-mux: Handle -EPROBE_DEFER correctly Date: Tue, 24 Aug 2021 12:55:07 -0400 Message-Id: <20210824165607.709387-68-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Saravana Kannan [ Upstream commit 7bd0cef5dac685f09ef8b0b2a7748ff42d284dc7 ] When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't ignore it and continue registering the rest of the mdiobus children. This would permanently prevent the deferring child mdiobus from working instead of reattempting it in the future. So, if a child mdiobus needs to be reattempted in the future, defer the entire mdio-mux initialization. This fixes the issue where PHYs sitting under the mdio-mux aren't initialized correctly if the PHY's interrupt controller is not yet ready when the mdio-mux is being probed. Additional context in the link below. Fixes: 0ca2997d1452 ("netdev/of/phy: Add MDIO bus multiplexer support.") Link: https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t Signed-off-by: Saravana Kannan Reviewed-by: Andrew Lunn Acked-by: Marc Zyngier Tested-by: Marc Zyngier Acked-by: Kevin Hilman Tested-by: Kevin Hilman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/mdio/mdio-mux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c index d6ed9033339c..3dde0c2b3e09 100644 --- a/drivers/net/mdio/mdio-mux.c +++ b/drivers/net/mdio/mdio-mux.c @@ -175,11 +175,15 @@ int mdio_mux_init(struct device *dev, cb->mii_bus->write = mdio_mux_write; r = of_mdiobus_register(cb->mii_bus, child_bus_node); if (r) { + mdiobus_free(cb->mii_bus); + if (r == -EPROBE_DEFER) { + ret_val = r; + goto err_loop; + } + devm_kfree(dev, cb); dev_err(dev, "Error: Failed to register MDIO bus for child %pOF\n", child_bus_node); - mdiobus_free(cb->mii_bus); - devm_kfree(dev, cb); } else { cb->next = pb->children; pb->children = cb; -- 2.30.2