Skip to contentSkip to conversation

ARM: imx: add missing clk_disable_unprepare() in imx_mmdc_remove()

PATCH In review Yang Yingliang 2 participants 3 messages May 17, 2021 – May 24, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx: add missing clk_disable_unprepare() in imx_mmdc_remove()

clock source is prepared and enabled by clk_prepare_enable() in probe function, but no disable or unprepare in remove.

Fixes 9454a0caff6a ("ARM: imx: add mmdc ipg clock operation for mmdc")
---
 arch/arm/mach-imx/mmdc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mmdc.c +2 -1
index 0dfd0ae7a63d..7d87fa8c70a9 100644
@@ -77,6 +77,7 @@ static const struct of_device_id imx_mmdc_dt_ids[] = {
 	{ /* sentinel */ }
 };
 
+struct clk *mmdc_ipg_clk;
 #ifdef CONFIG_PERF_EVENTS
 
 static enum cpuhp_state cpuhp_mmdc_state;
@@ -463,6 +464,7 @@ static int imx_mmdc_remove(struct platform_device *pdev)
 	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
 	perf_pmu_unregister(&pmu_mmdc->pmu);
 	kfree(pmu_mmdc);
+	clk_disable_unprepare(mmdc_ipg_clk);
 	return 0;
 }
 
@@ -536,7 +538,6 @@ static int imx_mmdc_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	void __iomem *mmdc_base, *reg;
-	struct clk *mmdc_ipg_clk;
 	u32 val;
 	int err;
 
Signature · 1 line
2.25.1
#1 lore raw
Quoted 15 lines · Yang Yingliang

clock source is prepared and enabled by clk_prepare_enable() in probe function, but no disable or unprepare in remove.

Fixes 9454a0caff6a ("ARM: imx: add mmdc ipg clock operation for mmdc")
---
 arch/arm/mach-imx/mmdc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mmdc.c +0 -0
index 0dfd0ae7a63d..7d87fa8c70a9 100644

arch/arm/mach-imx/mmdc.c static const struct of_device_id imx_mmdc_dt_ids[] = { · line 80

Quoted 4 lines
arch/arm/mach-imx/mmdc.c +1 -0
@@ -77,6 +77,7 @@ static const struct of_device_id imx_mmdc_dt_ids[] = {
 	{ /* sentinel */ }
 };
 
+struct clk *mmdc_ipg_clk;

Missing static. But an even better change should be putting it into struct mmdc_pmu, I guess.

Shawn

Quoted 22 lines
arch/arm/mach-imx/mmdc.c +1 -1
 #ifdef CONFIG_PERF_EVENTS
 
 static enum cpuhp_state cpuhp_mmdc_state;
@@ -463,6 +464,7 @@ static int imx_mmdc_remove(struct platform_device *pdev)
 	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
 	perf_pmu_unregister(&pmu_mmdc->pmu);
 	kfree(pmu_mmdc);
+	clk_disable_unprepare(mmdc_ipg_clk);
 	return 0;
 }
 
@@ -536,7 +538,6 @@ static int imx_mmdc_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	void __iomem *mmdc_base, *reg;
-	struct clk *mmdc_ipg_clk;
 	u32 val;
 	int err;
 
Signature · 1 line
2.25.1
#2 lore raw
Quoted 19 lines · Shawn Guo
Quoted 18 lines · Yang Yingliang

clock source is prepared and enabled by clk_prepare_enable() in probe function, but no disable or unprepare in remove.

Fixes 9454a0caff6a ("ARM: imx: add mmdc ipg clock operation for mmdc")
---
  arch/arm/mach-imx/mmdc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mmdc.c +0 -0
index 0dfd0ae7a63d..7d87fa8c70a9 100644
@@ -77,6 +77,7 @@ static const struct of_device_id imx_mmdc_dt_ids[] = {
  	{ /* sentinel */ }
  };
 
Quoted 3 lines

arch/arm/mach-imx/mmdc.c static const struct of_device_id imx_mmdc_dt_ids[] = { · line 80

Quoted 1 line
arch/arm/mach-imx/mmdc.c +1 -0
+struct clk *mmdc_ipg_clk;

Missing static. But an even better change should be putting it into struct mmdc_pmu, I guess.

OK, I will send a v2 later.

Thanks,

Yang

Quoted 26 lines

Shawn

Quoted 22 lines
arch/arm/mach-imx/mmdc.c +1 -1
  #ifdef CONFIG_PERF_EVENTS
 
  static enum cpuhp_state cpuhp_mmdc_state;
@@ -463,6 +464,7 @@ static int imx_mmdc_remove(struct platform_device *pdev)
  	cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
  	perf_pmu_unregister(&pmu_mmdc->pmu);
  	kfree(pmu_mmdc);
+	clk_disable_unprepare(mmdc_ipg_clk);
  	return 0;
  }
 
@@ -536,7 +538,6 @@ static int imx_mmdc_probe(struct platform_device *pdev)
  {
  	struct device_node *np = pdev->dev.of_node;
  	void __iomem *mmdc_base, *reg;
-	struct clk *mmdc_ipg_clk;
  	u32 val;
  	int err;
 
Signature · 1 line
2.25.1

.