All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Peter De Schrijver <pdeschrijver@nvidia.com>,
	Prashant Gaikwad <pgaikwad@nvidia.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 02/30] clk: tegra: Don't warn three times about failure to unregister
Date: Sun, 12 Mar 2023 17:14:44 +0100	[thread overview]
Message-ID: <20230312161512.2715500-3-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20230312161512.2715500-1-u.kleine-koenig@pengutronix.de>

tegra124_dfll_fcpu_remove() calls tegra_dfll_unregister() and the former
emits an error message if the latter fails. In that case
tegra_dfll_unregister() already printed an error message. Additionally
tegra124_dfll_fcpu_remove() returns an error code which results in yet
another warning emitted by platform_remove().

So drop the error message from tegra124_dfll_fcpu_remove() and let it
return 0. (Retuning 0 has no side effect but suppressing the error
message in platform_remove().)

Also add two comments about exiting early being wrong. This is something
that needs fixing separately.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/clk/tegra/clk-dfll.c               |  5 ++++-
 drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 11 ++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c
index 41433927b55c..58fa5a59e0c7 100644
--- a/drivers/clk/tegra/clk-dfll.c
+++ b/drivers/clk/tegra/clk-dfll.c
@@ -2081,7 +2081,10 @@ struct tegra_dfll_soc_data *tegra_dfll_unregister(struct platform_device *pdev)
 {
 	struct tegra_dfll *td = platform_get_drvdata(pdev);
 
-	/* Try to prevent removal while the DFLL is active */
+	/*
+	 * Note that exiting early here doesn't prevent unbinding the driver.
+	 * Exiting early here only leaks some resources.
+	 */
 	if (td->mode != DFLL_DISABLED) {
 		dev_err(&pdev->dev,
 			"must disable DFLL before removing driver\n");
diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
index 5e339ad0a97c..15c5e14dd82f 100644
--- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
+++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
@@ -616,12 +616,13 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev)
 {
 	struct tegra_dfll_soc_data *soc;
 
+	/*
+	 * Note that exiting early here is dangerous as after this function
+	 * returns *soc is freed.
+	 */
 	soc = tegra_dfll_unregister(pdev);
-	if (IS_ERR(soc)) {
-		dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n",
-			PTR_ERR(soc));
-		return PTR_ERR(soc);
-	}
+	if (IS_ERR(soc))
+		return 0;
 
 	tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq);
 
-- 
2.39.1


  parent reply	other threads:[~2023-03-12 16:15 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-12 16:14 [PATCH 00/30] clk: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-12 16:14 ` Uwe Kleine-König
2023-03-12 16:14 ` [PATCH 01/30] clk: mediatek: Make mtk_clk_simple_remove() return void Uwe Kleine-König
2023-03-12 16:14   ` Uwe Kleine-König
2023-03-13  8:54   ` AngeloGioacchino Del Regno
2023-03-13  8:54     ` AngeloGioacchino Del Regno
2023-03-13  9:45     ` Uwe Kleine-König
2023-03-13  9:45       ` Uwe Kleine-König
2023-03-12 16:14 ` Uwe Kleine-König [this message]
2023-03-29  2:34   ` [PATCH 02/30] clk: tegra: Don't warn three times about failure to unregister Stephen Boyd
2023-03-12 16:14 ` [PATCH 03/30] clk: xilinx: Drop if block with always false condition Uwe Kleine-König
2023-03-12 16:14   ` Uwe Kleine-König
2023-03-29  2:35   ` Stephen Boyd
2023-03-29  2:35     ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 04/30] clk: axs10x: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-29  2:35   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 05/30] clk: bcm: " Uwe Kleine-König
2023-03-12 16:14   ` Uwe Kleine-König
2023-03-14 21:28   ` Florian Fainelli
2023-03-14 21:28     ` Florian Fainelli
2023-03-29  2:35   ` Stephen Boyd
2023-03-29  2:35     ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 06/30] clk: axi-clkgen: " Uwe Kleine-König
2023-03-29  2:36   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 07/30] clk: axm5516: " Uwe Kleine-König
2023-03-29  2:36   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 08/30] clk: fixed-factor: " Uwe Kleine-König
2023-03-29  2:36   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 09/30] clk: fixed-mmio: " Uwe Kleine-König
2023-03-29  2:36   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 10/30] clk: fixed-rate: " Uwe Kleine-König
2023-03-29  2:37   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 11/30] clk: hsdk-pll: " Uwe Kleine-König
2023-03-29  2:37   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 12/30] clk: palmas: " Uwe Kleine-König
2023-03-29  2:37   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 13/30] clk: pwm: " Uwe Kleine-König
2023-03-29  2:37   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 14/30] clk: s2mps11: " Uwe Kleine-König
2023-03-12 16:22   ` Krzysztof Kozlowski
2023-03-29  2:37   ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 15/30] clk: scpi: " Uwe Kleine-König
2023-03-12 16:14   ` Uwe Kleine-König
2023-03-16 15:01   ` Sudeep Holla
2023-03-16 15:01     ` Sudeep Holla
2023-03-16 15:48     ` Uwe Kleine-König
2023-03-16 15:48       ` Uwe Kleine-König
2023-03-17  0:31       ` Stephen Boyd
2023-03-17  0:31         ` Stephen Boyd
2023-03-29  2:38   ` Stephen Boyd
2023-03-29  2:38     ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 16/30] clk: stm32mp1: " Uwe Kleine-König
2023-03-12 16:14   ` Uwe Kleine-König
2023-03-29  2:38   ` Stephen Boyd
2023-03-29  2:38     ` Stephen Boyd
2023-03-12 16:14 ` [PATCH 17/30] clk: hisilicon: " Uwe Kleine-König
2023-03-29  2:38   ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 18/30] clk: keystone: " Uwe Kleine-König
2023-03-12 16:15   ` Uwe Kleine-König
2023-03-29  2:39   ` Stephen Boyd
2023-03-29  2:39     ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 19/30] clk: mediatek: " Uwe Kleine-König
2023-03-12 16:15   ` Uwe Kleine-König
2023-03-29  2:39   ` Stephen Boyd
2023-03-29  2:39     ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 20/30] clk: mmp: " Uwe Kleine-König
2023-03-29  2:39   ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 21/30] clk: mvebu: " Uwe Kleine-König
2023-03-29  2:39   ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 22/30] clk: qcom: " Uwe Kleine-König
2023-03-12 16:15 ` [PATCH 23/30] clk: renesas: " Uwe Kleine-König
2023-03-13  9:05   ` Geert Uytterhoeven
2023-03-12 16:15 ` [PATCH 24/30] clk: samsung: " Uwe Kleine-König
2023-03-12 16:15   ` Uwe Kleine-König
2023-03-12 16:33   ` (subset) " Krzysztof Kozlowski
2023-03-12 16:33     ` Krzysztof Kozlowski
2023-03-12 16:15 ` [PATCH 25/30] clk: stm32: " Uwe Kleine-König
2023-03-12 16:15   ` Uwe Kleine-König
2023-03-29  2:40   ` Stephen Boyd
2023-03-29  2:40     ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 26/30] clk: tegra: " Uwe Kleine-König
2023-03-29  2:40   ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 27/30] clk: ti: " Uwe Kleine-König
2023-03-29  2:40   ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 28/30] clk: uniphier: " Uwe Kleine-König
2023-03-12 16:15   ` Uwe Kleine-König
2023-03-29  2:40   ` Stephen Boyd
2023-03-29  2:40     ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 29/30] clk: x86: " Uwe Kleine-König
2023-03-29  2:40   ` Stephen Boyd
2023-03-12 16:15 ` [PATCH 30/30] clk: xilinx: " Uwe Kleine-König
2023-03-12 16:15   ` Uwe Kleine-König
2023-03-29  2:41   ` Stephen Boyd
2023-03-29  2:41     ` Stephen Boyd
2023-03-15 23:35 ` (subset) [PATCH 00/30] clk: " Bjorn Andersson
2023-03-15 23:35   ` Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230312161512.2715500-3-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jonathanh@nvidia.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgaikwad@nvidia.com \
    --cc=sboyd@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.