Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4018676pxb; Mon, 8 Feb 2021 06:09:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOwCIgYBN9l2Oimn25HGRGXfrL4mMtpVCtb4UWlZnKS71pKKL9rUvYFSpvMT8YfBbUY6Cw X-Received: by 2002:a17:906:d922:: with SMTP id rn2mr17682636ejb.414.1612793377575; Mon, 08 Feb 2021 06:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612793377; cv=none; d=google.com; s=arc-20160816; b=Dr9TVYvBZAW4UyYXErCJRo/49/YJz4rB/9/EEhNjewn+d2T9ZedhMGXceagOVdYWmM E/DWQbMLczO/7dMswCwCVhHrXjZdhsWIhRo5XuE++WTCqFnq1WAhJidgrP+jJIEOX/Cn Yq8cE8ujUJoBHPGvieSSsJrF/dHYlSe20DMCaR3Aligdwh8fDzx3Uy7nsfF+rPJohf+D rdIoaI1c7FdI9GRhglMEGmhGmdk5dhhvyUZVjsO/Wa2NjOR21M8RkxOmT5uYXYHQ5R7C RWC/VlhOstuiwo4wEFijEYbJXx/DqwU5du/qMoFvAXfQBs8+SmaQICu2aTVLf1p2NN0v UeXA== 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; bh=eV52iBi8e2+Md/ivUL/s5fkKHWDacYdnV71aY3P8RqI=; b=jp+lE+FHVwY0DbSqMYY4Kih+meU4zLX27hXueWi64k4fDq/zff2HC28H9Xmw/sWRxz QLCN7lFtY0Jrbp6gLKXOaCuuJ0CBqZ/v/lOTkWg05b5ivFmuWYYgKKBumx+EutzO3nn4 NVk1aal6vtjiFn+y7R3cxluEM2SyiEO5/+xpkf2o8VjDXw7zAog1rIUZbD6SqqoVil3s kuPa4eAco9C69jJrSwvAefghq7RYPjO9qk+BFByorl6RIkqALvuGlBL2C9N8IsQWe91r GoC0Ht+jCOvwOg19Ze23jVkqNkraWymyTYotCP/DGiOqvY9Y2EmX4Qo+x3T3COZ7KIT5 lq7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si14219543ejl.444.2021.02.08.06.09.04; Mon, 08 Feb 2021 06:09:37 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230417AbhBHOGG (ORCPT + 99 others); Mon, 8 Feb 2021 09:06:06 -0500 Received: from mail.baikalelectronics.com ([87.245.175.226]:57078 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231909AbhBHN5v (ORCPT ); Mon, 8 Feb 2021 08:57:51 -0500 From: Serge Semin To: Rob Herring , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Johan Hovold , Maxime Ripard , Joao Pinto , Lars Persson , Maxime Coquelin CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Vyacheslav Mitrofanov , , , , , Subject: [PATCH v2 13/24] net: stmmac: Fix clocks left enabled on glue-probes failure Date: Mon, 8 Feb 2021 16:55:57 +0300 Message-ID: <20210208135609.7685-14-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> References: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generic clocks request and preparation have been moved from stmmac_dvr_probe()/stmmac_init_ptp() to the stmmac_probe_config_dt() method in the framework of commit f573c0b9c4e0 ("stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure"). At the same time the clocks disabling and reset assertion have been left in stmmac_dvr_remove() instead of also being moved to the symmetric antagonistic method - stmmac_remove_config_dt(). Due to that all the glue drivers probe cleanup-on-failure paths don't perform the generic clocks disable/unprepare procedure, which of course is wrong. Fix it by moving the clocks disable/unprepare methods invocation to the stmmac_remove_config_dt() function. Fixes: f573c0b9c4e0 ("stmmac: move stmmac_clk, pclk, clk_ptp_ref and stmmac_rst to platform structure") Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 -- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 103d2448e9e0..56b914b5527a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -665,6 +665,8 @@ static void intel_eth_pci_remove(struct pci_dev *pdev) pci_free_irq_vectors(pdev); + clk_disable_unprepare(priv->plat->stmmac_clk); + clk_unregister_fixed_rate(priv->plat->stmmac_clk); pcim_iounmap_regions(pdev, BIT(0)); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 26b971cd4da5..b371842d9337 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -5157,8 +5157,6 @@ int stmmac_dvr_remove(struct device *dev) phylink_destroy(priv->phylink); if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst); - clk_disable_unprepare(priv->plat->pclk); - clk_disable_unprepare(priv->plat->stmmac_clk); if (priv->hw->pcs != STMMAC_PCS_TBI && priv->hw->pcs != STMMAC_PCS_RTBI) stmmac_mdio_unregister(ndev); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index c9feac70ca77..ff66c470f07f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -621,11 +621,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac) * @pdev: platform_device structure * @plat: driver data platform structure * - * Release resources claimed by stmmac_probe_config_dt(). + * Disable and release resources claimed by stmmac_probe_config_dt(). */ void stmmac_remove_config_dt(struct platform_device *pdev, struct plat_stmmacenet_data *plat) { + clk_disable_unprepare(plat->pclk); + clk_disable_unprepare(plat->stmmac_clk); of_node_put(plat->phy_node); of_node_put(plat->mdio_node); } -- 2.29.2