Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1144132iob; Wed, 4 May 2022 15:52:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4V6fxv8ArSi0SA2R/Q6vgt4tSdD272rYJ8pHlsu6pUydP6UI7M+rEN2L/1tdrLiHFQkHU X-Received: by 2002:aa7:d9d6:0:b0:425:dafc:2fc6 with SMTP id v22-20020aa7d9d6000000b00425dafc2fc6mr25517625eds.340.1651704746702; Wed, 04 May 2022 15:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651704746; cv=none; d=google.com; s=arc-20160816; b=OWyfuMb6quLsN0sr2Ua8CBApBpY4c/nNQBSe2C3Prb8LtLgCkCKqcle08pt75G726h Hnw5eIvzpjWptL5Ked2y3xBp7s/f75PgygwuAKCEPiioD4qfayZQMrnN4o80RmaNs13Q wB+ngAHtEpHNkbDjO1ZBMMmiLpACuHFC5rqVRVrFFBagFocYL8hWVkRE1Q/it26yUEJp 5gzaveKdHaLDpN3kPKvw7jucB8Z5pjGo4/vgJDaFEEYfwsZKKy0U0HrUih+tYpM7sUgE chDQHY0D+PjZFqEFjYigM51TX9gB955Q1DN8h0+9oGZgOR2qWsa41OTORT5tlc8XuSOe ce0Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aoW3q2twViwYm9GT4wPZf0TqwodKJSaAXgGHMTYWEVk=; b=ShtJjDgzlgPnvnQut4LPV2WWZMy0X+siJ0NjPd19AiRH+lNB8WtgPzkSJcSkqPfjB/ ZxCgOdxxomwByERrFJpAp1JOvJk5rgOwqMl3Tr3CKLrkJ1TsV0AuSHP61lcANoqbyja6 OIthj8qANJ6zjVlH3NKrC/38yw1LxTmtC1UUewPXAnIraLEeriL6Gr0abZd4uCpTVWms /fQjJjIe2eidOqcNJgnS4TnJsifffp+4EorChA4T6xOtAKDPf2v0ZUh+sOChuIpjdVs4 d+cES8sTQGzObhZr0z1yRhqtgT9RfovzkLRs0ykhH/EJlGE4cL3x9ozBIGiPSdd4BOAo OZLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ANc/UoNJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb8-20020a170907784800b006efe546a91esi258635ejc.140.2022.05.04.15.52.04; Wed, 04 May 2022 15:52:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ANc/UoNJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356199AbiEDR2w (ORCPT + 99 others); Wed, 4 May 2022 13:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356172AbiEDRJD (ORCPT ); Wed, 4 May 2022 13:09:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCF4452B3D; Wed, 4 May 2022 09:54:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17C16617BD; Wed, 4 May 2022 16:54:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67F23C385AF; Wed, 4 May 2022 16:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683294; bh=puxZb8keBI0MxGWFKEJg7XUlq5HvNRAXuB4e6S/Tg5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ANc/UoNJSpvX2Amep1G8sXwWqRHuEs859iBDeJJjSydfZuLwku17sFIlhsnO/NG6Q q/KIOyEl63t2A8Le6x2ZmnS+UGmDZ0Pu3EtrCrQQzSj0RurzyWSlv0nBz5zKk7Bvco B2WZPQwp8a9sg7LH+Pqujb9wYUvcltzaY4cNBUl8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinh Nguyen , Jakub Kicinski Subject: [PATCH 5.15 148/177] net: ethernet: stmmac: fix write to sgmii_adapter_base Date: Wed, 4 May 2022 18:45:41 +0200 Message-Id: <20220504153106.556326710@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinh Nguyen commit 5fd1fe4807f91ea0cca043114d929faa11bd4190 upstream. I made a mistake with the commit a6aaa0032424 ("net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link"). I should have tested against both scenario of having a SGMII interface and one without. Without the SGMII PCS TSE adpater, the sgmii_adapter_base address is NULL, thus a write to this address will fail. Cc: stable@vger.kernel.org Fixes: a6aaa0032424 ("net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link") Signed-off-by: Dinh Nguyen Link: https://lore.kernel.org/r/20220420152345.27415-1-dinguyen@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -65,8 +65,9 @@ static void socfpga_dwmac_fix_mac_speed( struct phy_device *phy_dev = ndev->phydev; u32 val; - writew(SGMII_ADAPTER_DISABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); + if (sgmii_adapter_base) + writew(SGMII_ADAPTER_DISABLE, + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); if (splitter_base) { val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG); @@ -88,10 +89,11 @@ static void socfpga_dwmac_fix_mac_speed( writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG); } - writew(SGMII_ADAPTER_ENABLE, - sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); - if (phy_dev) + if (phy_dev && sgmii_adapter_base) { + writew(SGMII_ADAPTER_ENABLE, + sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed); + } } static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)