memory: tegra210: Fix opp table cleanup
Subsystems (2)
PATCH 1/1 memory: tegra210: Fix opp table cleanup
The original change did not clean up the opp table or hardware table on probe error or on remove.
---
Change-Id: Ie40abdc1f2b1a66ef60cabf00d64cc5ff069ea91
--- drivers/memory/tegra/tegra210-emc-core.c | 23 ++++++++++++++++++----- drivers/memory/tegra/tegra210-emc.h | 1 + 2 files changed, 19 insertions(+), 5 deletions(-)
drivers/memory/tegra/tegra210-emc-core.c +18 -5
@@ -1960,13 +1960,13 @@ static int tegra210_emc_opp_table_init(struct tegra210_emc *emc)u32 hw_version =BIT (tegra_sku_info.soc_speedo_id);struct dev_pm_opp *opp;unsigned long rate; -int opp_token, err, max_opps, i; +int err, max_opps, i; err =dev_pm_opp_set_supported_hw (emc->dev, &hw_version,1 );if (err <0 )return dev_err_probe (emc->dev, err,"failed to set OPP supported HW\n" ); - opp_token = err; + emc->hw_opp_token = err; err =dev_pm_opp_of_add_table (emc->dev);if (err) {
@@ -2009,11 +2009,21 @@ static int tegra210_emc_opp_table_init(struct tegra210_emc *emc) remove_table:dev_pm_opp_of_remove_table (emc->dev); put_hw_table: -dev_pm_opp_put_supported_hw (opp_token); +dev_pm_opp_put_supported_hw (emc->hw_opp_token); + emc->hw_opp_token =0 ;return err; } +static void tegra210_emc_opp_table_cleanup (struct tegra210_emc *emc) +{ +if (emc->hw_opp_token) { +dev_pm_opp_of_remove_table (emc->dev); +dev_pm_opp_put_supported_hw (emc->hw_opp_token); + emc->hw_opp_token =0 ; + } +} +static void tegra210_emc_detect (struct tegra210_emc *emc) {u32 value;
@@ -2227,7 +2237,7 @@ static int tegra210_emc_probe(struct platform_device *pdev)tegra210_emc_rate_requests_init (emc);tegra210_emc_interconnect_init (emc); }else if (err != -ENODEV ) { -return err; + goto detach; } cd = devm_thermal_of_cooling_device_register(emc->dev, np, "emc", emc,
@@ -2236,11 +2246,13 @@ static int tegra210_emc_probe(struct platform_device *pdev) err =PTR_ERR (cd);dev_err (emc->dev,"failed to register cooling device: %d\n" , err); - goto detach; + goto cleanup_table; }return 0 ; +cleanup_table: +tegra210_emc_opp_table_cleanup (emc); detach:debugfs_remove_recursive (emc->debugfs.root);tegra210_clk_emc_detach (emc->clk);
@@ -2254,6 +2266,7 @@ static void tegra210_emc_remove(struct platform_device *pdev) {struct tegra210_emc *emc =platform_get_drvdata (pdev); +tegra210_emc_opp_table_cleanup (emc);debugfs_remove_recursive (emc->debugfs.root);tegra210_clk_emc_detach (emc->clk);of_reserved_mem_device_release (emc->dev);
drivers/memory/tegra/tegra210-emc.h +1 -0
@@ -946,6 +946,7 @@ struct tegra210_emc {struct tegra210_clk_emc_provider provider;struct icc_provider icc_provider; +int hw_opp_token;/* * There are multiple sources in the EMC driver which could request
---
base-commit: d724c6f85e80a23ed46b7ebc6e38b527c09d64f5
change-id: 20251123-tegra210-actmon-fix-9f8ea4680d04
Best regards,
Signature · 1 line
Aaron Kling <[email protected]>
Krzysztof Kozlowski
maintainerQuoted 6 lines · On 24/11/2025 07:19, Aaron Kling via B4 Relay wrote:
From: Aaron Kling <[email protected]>
The original change did not clean up the opp table or hardware table on probe error or on remove.
Fixes b33c93babead ("memory: tegra210: Support interconnect framework")
There is no such commit anymore. Like I said in the other thread (and I Cc-ed you on pull request) I dropped all ICC patches.
Quoted 5 lines
Reported-by Dan Carpenter <[email protected]>Signed-off-by Aaron Kling <[email protected]>---
Change-Id: Ie40abdc1f2b1a66ef60cabf00d64cc5ff069ea91
Please do not use Gerrit stuff here.
Best regards,
Krzysztof
Quoted 12 lines · Krzysztof Kozlowski
Quoted 6 lines · On 24/11/2025 07:19, Aaron Kling via B4 Relay wrote:
From: Aaron Kling <[email protected]>
The original change did not clean up the opp table or hardware table on probe error or on remove.
Fixes b33c93babead ("memory: tegra210: Support interconnect framework")There is no such commit anymore. Like I said in the other thread (and I Cc-ed you on pull request) I dropped all ICC patches.
Quoted 7 lines
Quoted 5 lines
Reported-by Dan Carpenter <[email protected]>Signed-off-by Aaron Kling <[email protected]>---
Change-Id: Ie40abdc1f2b1a66ef60cabf00d64cc5ff069ea91Please do not use Gerrit stuff here.
Ah, blast. It got snuck in through the b4 cover letter. At least it's not in the actual commit message, that much gets caught by b4 checks. I'll remove it locally for if a new revision is needed.
Aaron