From patchwork Tue Apr 15 16:29:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 14052458 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20904C369AB for ; Tue, 15 Apr 2025 16:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:Content-Type :Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Jdg65xfoNMLU/+2u8rET385fzNYh4G19EMmnW4YLQWI=; b=4k0Z/syV00wz9tWsmiIGYVJJmb xkQbMSq/r2dleibdme9+Q7HzND4EF4dJWoGeyn11FA4aTF7UoLWPufRH+nVKIIttpI94y5ZSqJRYv Z2JqJ4IINzeELHpN/fVZ9KCgM7XMgwNl4hfjgSvKwsjzQ62u7OmAAwJBs5BA3SYu/RN2puXhjht8w 3zIx4Lz9YrsMEjpnQ+PgdEUG3IxCRTmbW3yL5EUac8FulYe8lvgspvIIi6kemYadN2k1AeB+0RG8J TRLKVVI1dW06uIJbf0ZMDXDWJJpoW1XEukPqXJ91Wcxh2rsrRIeYPd0x0D+4WLkJ4nSsnvMiwo34L fCpjRyUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u4jZP-00000006Tpf-0rNj; Tue, 15 Apr 2025 16:55:35 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u4jAi-00000006Q0r-41zn for linux-arm-kernel@lists.infradead.org; Tue, 15 Apr 2025 16:30:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Jdg65xfoNMLU/+2u8rET385fzNYh4G19EMmnW4YLQWI=; b=j6ZKx2VUeHyUGjPZC6NE17Gbq6 frgYfZ3ZiEA3N2JRdRRHz7AgVNFur6HVVz0TpAbRw7nwXUHq5AKvIMWigGYs/1G9MObxPHrKeO3Lf RCULYHULslQfBsp3lZht2eDcivF9lLIdWtVOROFXD9kJLpqYBLgv3tXSNCHnLer445esAFVVZ9BV0 wDBKod+/8oXsNje0ulIpS7+AVuPdiI8eczDV2+S9izdK/Ygp75d5432FcDma12UaCQ9gIe6ATR6u8 gB039qQFE7309dQxYAgy3loM5sEtWDkh33+a72geL7moeefMc4kXlGgat0nIWXZh5ffcf3UVlSb1Z JzKZPHtg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54228 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u4jAd-0008U4-1U; Tue, 15 Apr 2025 17:29:59 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1u4jA2-000r1b-1w; Tue, 15 Apr 2025 17:29:22 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH net-next 4/5] net: stmmac: socfpga: call set_phy_mode() before registration MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 15 Apr 2025 17:29:22 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250415_093004_999303_A2A8D9DD X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Initialisation/setup after registration is a bug. This is the second of two patches fixing this in socfpga. The set_phy_mode() does various hardware setup that would interfere with a netdev that has been published, and thus available to be opened by the kernel/userspace. Move the call to set_phy_mode() before calling stmmac_dvr_probe(). This also simplifies the probe function as there is no need to unregister the netdev if set_phy_mode() fails. Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 69ffc52c0275..251d8b72bed5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -501,20 +501,11 @@ static int socfpga_dwmac_probe(struct platform_device *pdev) plat_dat->riwt_off = 1; - ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (ret) - return ret; - ret = socfpga_dwmac_init(pdev, dwmac); if (ret) - goto err_dvr_remove; - - return 0; - -err_dvr_remove: - stmmac_dvr_remove(&pdev->dev); + return ret; - return ret; + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); } static const struct socfpga_dwmac_ops socfpga_gen5_ops = {