From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61496129ED2; Mon, 18 Dec 2023 13:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="X8AgjWJA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DA19C433C7; Mon, 18 Dec 2023 13:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702907586; bh=98jXUuRixcb6rFI/nKOr1YGSM/bQUxNE/Qt+AAdJMtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8AgjWJA93eCkdeJiHXskBcWXvLnEn5AXA6KulysHYZ6qQZ5byDgeGGHCCD9pUvtR HRQBsS8hli0HCZoZsDIxHHXlgss6gp5917d3JnWl5BIKPQVJ85m9hxE+JfEVF+EZu9 tzw5IRD37C58GW/oSUaEim8Gy3JKc4THVkTsAqnA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrew Halaney , Serge Semin , Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 14/36] net: stmmac: Handle disabled MDIO busses from devicetree Date: Mon, 18 Dec 2023 14:51:24 +0100 Message-ID: <20231218135042.376149443@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218135041.876499958@linuxfoundation.org> References: <20231218135041.876499958@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrew Halaney [ Upstream commit e23c0d21ce9234fbc31ece35663ababbb83f9347 ] Many hardware configurations have the MDIO bus disabled, and are instead using some other MDIO bus to talk to the MAC's phy. of_mdiobus_register() returns -ENODEV in this case. Let's handle it gracefully instead of failing to probe the MAC. Fixes: 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet controllers.") Signed-off-by: Andrew Halaney Reviewed-by: Serge Semin Link: https://lore.kernel.org/r/20231212-b4-stmmac-handle-mdio-enodev-v2-1-600171acf79f@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -360,7 +360,11 @@ int stmmac_mdio_register(struct net_devi new_bus->parent = priv->device; err = of_mdiobus_register(new_bus, mdio_node); - if (err != 0) { + if (err == -ENODEV) { + err = 0; + dev_info(dev, "MDIO bus is disabled\n"); + goto bus_register_fail; + } else if (err) { dev_err(dev, "Cannot register the MDIO bus\n"); goto bus_register_fail; }