Skip to content

Commit c73e435

Browse files
Uwe Kleine-Königbebarino
authored andcommitted
clk: tegra: Don't warn three times about failure to unregister
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> Link: https://lore.kernel.org/r/20230312161512.2715500-3-u.kleine-koenig@pengutronix.de Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent fe15c26 commit c73e435

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

drivers/clk/tegra/clk-dfll.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,10 @@ struct tegra_dfll_soc_data *tegra_dfll_unregister(struct platform_device *pdev)
20812081
{
20822082
struct tegra_dfll *td = platform_get_drvdata(pdev);
20832083

2084-
/* Try to prevent removal while the DFLL is active */
2084+
/*
2085+
* Note that exiting early here doesn't prevent unbinding the driver.
2086+
* Exiting early here only leaks some resources.
2087+
*/
20852088
if (td->mode != DFLL_DISABLED) {
20862089
dev_err(&pdev->dev,
20872090
"must disable DFLL before removing driver\n");

drivers/clk/tegra/clk-tegra124-dfll-fcpu.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,12 +616,13 @@ static int tegra124_dfll_fcpu_remove(struct platform_device *pdev)
616616
{
617617
struct tegra_dfll_soc_data *soc;
618618

619+
/*
620+
* Note that exiting early here is dangerous as after this function
621+
* returns *soc is freed.
622+
*/
619623
soc = tegra_dfll_unregister(pdev);
620-
if (IS_ERR(soc)) {
621-
dev_err(&pdev->dev, "failed to unregister DFLL: %ld\n",
622-
PTR_ERR(soc));
623-
return PTR_ERR(soc);
624-
}
624+
if (IS_ERR(soc))
625+
return 0;
625626

626627
tegra_cvb_remove_opp_table(soc->dev, soc->cvb, soc->max_freq);
627628

0 commit comments

Comments
 (0)