Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2919780pxb; Tue, 24 Aug 2021 10:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+uILGS6SidXnpQclTn/md1314bgYFARcdXLk/59kRV8dD9UKivxTJ5f+JsEuYYKWziBAN X-Received: by 2002:a92:d586:: with SMTP id a6mr26783708iln.283.1629826593223; Tue, 24 Aug 2021 10:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826593; cv=none; d=google.com; s=arc-20160816; b=fYjXZlYfmlyfYubOiDFcq8S443WIkKHjyiCb3FhSe1zhJjLi63Ji+lfo/okj3YNAot e1LFOTKWt5Tot8TKP308aTR844X95I01XqOUVz7HDF+LnhB68OO9NNPGQA2PKpbOMzAL 52dcd1QSAdW75OemwbF+71J1JSt/0fmJhmZS+d1r7B8LIHrNZyX8PLQo3/kG2wK9psvE 800/5AL3CsIbpDEK9l0srL+9/vJxXhwipNHxxWnWLjYelzFgLoBpOz7RyHvQMriW+aDE oIbhRA/8Xt94wCgfHy0g4LfYEovXKvO0QjMQIya9KsAu1ns8zHPQY6EDuiDXROqMvHhx RP9A== 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=WQ3OeoY71dXD+Xp8XPDFPMzzpR9OqS0UPZ7Ttmiu+fY=; b=WshYgkELphyT4m7BPIVmlA2tIHBZuVZbPSPECw6/aS7DllUfFdnaPIvW8ohtB+k2o4 wMMFH+mv8d1/g6/FK+dm7mZqMoxslQ/c8at0TakhgnQ2Zn5bdEdHGmOqcmvFQMA8QJZc 3aBmBO49OqbfGUU3LUjEtyrouYfQqlEfcYKlo4YqLDPnAeeh3RN6bEweGDuwn+BJvsBS 1S2xaaHDQCY3vV3DFKn1uCCkHui+wibDYWyVVP6s+sduswQFzoj85Nk8y/WwBVFgO290 oEnTxT0V1v1lbob/7NIWyALyLCkA2o5YvIprCKTGXvMGoe9J40Ot01L7BAAwApvpmwBI Vvcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HqMgClWo; 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 m46si5994761jaf.118.2021.08.24.10.36.21; Tue, 24 Aug 2021 10:36:33 -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=HqMgClWo; 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 S239836AbhHXRfm (ORCPT + 99 others); Tue, 24 Aug 2021 13:35:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:36774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241394AbhHXRbp (ORCPT ); Tue, 24 Aug 2021 13:31:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1494561B7D; Tue, 24 Aug 2021 17:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824752; bh=nB0Mq1iRSdfScHCGdWhpqfZ+nxmRj40xYfH7ASj8COk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HqMgClWozCuXFhnHDLcSk4bObZdzpJASEb6CnSrxs5rXRAFYh9mYnEw1wnwUfd8ld NM/VLknaWjEavdqv4jvq2osSUYPDJMzyk4RDdyr9ML7Z5GlhIgjOynMtT2DWZcAxJp +Q3P8eSq2PFmz7J8fRgxv3sToGkRjHLWloq4EIHpf+Jit9DYuDbPjjxd/RZiEDdAxM iBIK77/OYdjEea9E95jDJnjvA/xQNSFTUR9AZtjiGFN/Uef+h354dAWr6fdQfYJV+1 BuXdX97YO8DQqru3tLUEsvGiRaGOOAqSH31LMLgsS31bPSZI9799ovXWdbEUcLduuQ m3T8NwsyNr3fg== 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 4.14 55/64] net: mdio-mux: Handle -EPROBE_DEFER correctly Date: Tue, 24 Aug 2021 13:04:48 -0400 Message-Id: <20210824170457.710623-56-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170457.710623-1-sashal@kernel.org> References: <20210824170457.710623-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.245-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.245-rc1 X-KernelTest-Deadline: 2021-08-26T17:04+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/phy/mdio-mux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c index bb7e3f12a003..c16f875ed9ea 100644 --- a/drivers/net/phy/mdio-mux.c +++ b/drivers/net/phy/mdio-mux.c @@ -178,11 +178,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