From mboxrd@z Thu Jan 1 00:00:00 1970 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 9C7F9C19F2A for ; Sat, 30 Jul 2022 20:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HJ3S6effiq73SSB+Nl4vwEaEwp9Jv6lsgdfby3AevmA=; b=KmwFPJraf43KJ9 EOMG8SLs+iD8mfZwuomarjslejcyCsqu8Cd4Yfau4ikfxya9nsRymH4Q8eRpHYjVp6GMSvO+9w4FG qULtwSt94OoJGzVk7qV1RjWuMLkDx1n5AGa7DMRk79yOnGFwHrW9PeMtgzWDIxB1NEyu3SgelOfMp BjMyfcqKawfoGIdnBlmTcWBQ3z1onMH4KHNQwhrFlioHGmquXA4jXT1MemiSLBOhKM1KoqGjmVLoC WAV5+Z1BSCGJtQ9YdzHrUEswpXNvnurZgMt0TMzCKaCFPUfoleZSb3dL8IWRfTPQTKeCtaXp+2IoA u3KRqZr41vxzhbP/IM4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHsuZ-0046f2-VQ; Sat, 30 Jul 2022 20:18:12 +0000 Received: from mga06b.intel.com ([134.134.136.31] helo=mga06.intel.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHsuW-0046bk-Iu for linux-arm-kernel@lists.infradead.org; Sat, 30 Jul 2022 20:18:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659212288; x=1690748288; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cd3syrwIXsSarb0bdUv6tHAADb63fWwB5Q5t7g/Spnw=; b=bTRxl2/aB8GRAf27sGKSkX4Gaup1CqrnGgrN2XmsTLR0GWeTdz/nLnLX CBYdT18T6yHU3T5zNfRKG5O/FKp+nHfO9KHxCUeeoVGxT8plnTl9m7hvO Hr9FFFUIXACM+vC11c0A7AyoEGLYuxacJGPE//5DyXY548u/u+1xP/mVQ uVoasyUJ6drAgqHipVgYDPW174AxomQXp26AUpr7gdoyvWO2zXWCGrAdC 9I9cQMKvu/A7nOhPt1p1YR8Lgm5+5KoQU8WVyC9SMRa566RO0R4EahJf3 +aWlktrlJHJfkN4TCsQehwE+fRHGL772MsKVx4PneEcWT1ld+tZ6CKLNH w==; X-IronPort-AV: E=McAfee;i="6400,9594,10424"; a="350650111" X-IronPort-AV: E=Sophos;i="5.93,204,1654585200"; d="scan'208";a="350650111" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2022 13:18:04 -0700 X-IronPort-AV: E=Sophos;i="5.93,204,1654585200"; d="scan'208";a="728059168" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2022 13:18:00 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1oHsuK-001fXT-16; Sat, 30 Jul 2022 23:17:56 +0300 Date: Sat, 30 Jul 2022 23:17:56 +0300 From: Andy Shevchenko To: Christophe JAILLET Cc: vee.khee.wong@intel.com, weifeng.voon@intel.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joakim Zhang , Andrew Lunn , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/2] stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220730_131808_693323_D63C7C6E X-CRM114-Status: GOOD ( 27.03 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Jul 30, 2022 at 08:19:47PM +0200, Christophe JAILLET wrote: > Commit 09f012e64e4b ("stmmac: intel: Fix clock handling on error and remove > paths") removed this clk_disable_unprepare() > > This was partly revert by commit ac322f86b56c ("net: stmmac: Fix clock > handling on remove path") which removed this clk_disable_unprepare() > because: > " > While unloading the dwmac-intel driver, clk_disable_unprepare() is > being called twice in stmmac_dvr_remove() and > intel_eth_pci_remove(). This causes kernel panic on the second call. > " > > However later on, commit 5ec55823438e8 ("net: stmmac: add clocks management > for gmac driver") has updated stmmac_dvr_remove() which do not call > clk_disable_unprepare() anymore. > > So this call should now be called from intel_eth_pci_remove(). The correct way of fixing it (which might be very well end up functionally the same as this patch), is to introduce ->quit() in struct stmmac_pci_info and assign it correctly, because not all platforms enable clocks. Perhaps, we may leave this patch as is (for the sake of easy backporting) and apply another one as I explained above to avoid similar mistakes in the future. Reviewed-by: Andy Shevchenko > Fixes: 5ec55823438e8 ("net: stmmac: add clocks management for gmac driver") > Signed-off-by: Christophe JAILLET > --- > /!\ This patch is HIGHLY speculative. /!\ > > The corresponding clk_disable_unprepare() is still called within the pm > related stmmac_bus_clks_config() function. > > However, with my limited understanding of the pm API, I think it that the > patch is valid. > (in other word, does the pm_runtime_put() and/or pm_runtime_disable() > and/or stmmac_dvr_remove() can end up calling .runtime_suspend()) > > So please review with care, as I'm not able to test the change by myself. > > > If I'm wrong, maybe a comment explaining why it is safe to have this > call in the error handling path of the probe and not in the remove function > would avoid erroneous patches generated from static code analyzer to be > sent. > --- > drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c > index 52f9ed8db9c9..9f38642f86ce 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c > @@ -1134,6 +1134,7 @@ static void intel_eth_pci_remove(struct pci_dev *pdev) > > stmmac_dvr_remove(&pdev->dev); > > + clk_disable_unprepare(plat->stmmac_clk); > clk_unregister_fixed_rate(priv->plat->stmmac_clk); > > pcim_iounmap_regions(pdev, BIT(0)); > -- > 2.34.1 > -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel