diff mbox series

[-next] PM / devfreq: tegra30: Add missing clk_disable_unprepare in devm_tegra_devfreq_init_hw

Message ID 20240803063748.325133-1-cuigaosheng1@huawei.com (mailing list archive)
State New
Delegated to: Chanwoo Choi
Headers show
Series [-next] PM / devfreq: tegra30: Add missing clk_disable_unprepare in devm_tegra_devfreq_init_hw | expand

Commit Message

cuigaosheng Aug. 3, 2024, 6:37 a.m. UTC
Add the missing clk_disable_unprepare() before return in
devm_tegra_devfreq_init_hw().

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
 drivers/devfreq/tegra30-devfreq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Thierry Reding Aug. 29, 2024, 2:54 p.m. UTC | #1
On Sat, Aug 03, 2024 at 02:37:48PM GMT, Gaosheng Cui wrote:
> Add the missing clk_disable_unprepare() before return in
> devm_tegra_devfreq_init_hw().
> 
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
>  drivers/devfreq/tegra30-devfreq.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Acked-by: Thierry Reding <treding@nvidia.com>
Dmitry Osipenko Aug. 29, 2024, 3:40 p.m. UTC | #2
29.08.2024 17:54, Thierry Reding пишет:
> On Sat, Aug 03, 2024 at 02:37:48PM GMT, Gaosheng Cui wrote:
>> Add the missing clk_disable_unprepare() before return in
>> devm_tegra_devfreq_init_hw().
>>
>> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
>> ---
>>  drivers/devfreq/tegra30-devfreq.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> Acked-by: Thierry Reding <treding@nvidia.com>

devm_tegra_devfreq_deinit_hw() is invoked when
devm_add_action_or_reset() fails, disabling the clock. There is no
missing clk_disable_unprepare(). Patch is wrong :)
diff mbox series

Patch

diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c
index 4a4f0106ab9d..c19f8848d217 100644
--- a/drivers/devfreq/tegra30-devfreq.c
+++ b/drivers/devfreq/tegra30-devfreq.c
@@ -809,12 +809,15 @@  static int devm_tegra_devfreq_init_hw(struct device *dev,
 
 	err = devm_add_action_or_reset(dev, devm_tegra_devfreq_deinit_hw,
 				       tegra);
-	if (err)
+	if (err) {
+		clk_disable_unprepare(tegra->clock);
 		return err;
+	}
 
 	err = reset_control_reset(tegra->reset);
 	if (err) {
 		dev_err(dev, "Failed to reset hardware: %d\n", err);
+		clk_disable_unprepare(tegra->clock);
 		return err;
 	}