* [PATCH 1/2 for 4.19.y] ARM: imx: add missing clk_disable_unprepare()
@ 2021-09-06 23:27 Nobuhiro Iwamatsu
2021-09-07 13:13 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Nobuhiro Iwamatsu @ 2021-09-06 23:27 UTC (permalink / raw)
To: stable
Cc: gregkh, sashal, Yang Yingliang, Hulk Robot, Dong Aisheng,
Shawn Guo, Nobuhiro Iwamatsu
From: Yang Yingliang <yangyingliang@huawei.com>
commit f07ec85365807b3939f32d0094a6dd5ce065d1b9 upstream.
clock source is prepared and enabled by clk_prepare_enable()
in probe function, but no disable or unprepare in remove and
error path.
Fixes: 9454a0caff6a ("ARM: imx: add mmdc ipg clock operation for mmdc")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro1.iwamatsu@toshiba.co.jp>
---
arch/arm/mach-imx/mmdc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index ae0a61c61a6e12..ba830be0b53102 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -109,6 +109,7 @@ struct mmdc_pmu {
struct perf_event *mmdc_events[MMDC_NUM_COUNTERS];
struct hlist_node node;
struct fsl_mmdc_devtype_data *devtype_data;
+ struct clk *mmdc_ipg_clk;
};
/*
@@ -474,11 +475,13 @@ 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);
iounmap(pmu_mmdc->mmdc_base);
+ clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk);
kfree(pmu_mmdc);
return 0;
}
-static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base)
+static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base,
+ struct clk *mmdc_ipg_clk)
{
struct mmdc_pmu *pmu_mmdc;
char *name;
@@ -506,6 +509,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
}
mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
+ pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
if (mmdc_num == 0)
name = "mmdc";
else
@@ -579,9 +583,11 @@ static int imx_mmdc_probe(struct platform_device *pdev)
val &= ~(1 << BP_MMDC_MAPSR_PSD);
writel_relaxed(val, reg);
- err = imx_mmdc_perf_init(pdev, mmdc_base);
- if (err)
+ err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk);
+ if (err) {
iounmap(mmdc_base);
+ clk_disable_unprepare(mmdc_ipg_clk);
+ }
return err;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2 for 4.19.y] ARM: imx: add missing clk_disable_unprepare()
2021-09-06 23:27 [PATCH 1/2 for 4.19.y] ARM: imx: add missing clk_disable_unprepare() Nobuhiro Iwamatsu
@ 2021-09-07 13:13 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-09-07 13:13 UTC (permalink / raw)
To: Nobuhiro Iwamatsu
Cc: stable, sashal, Yang Yingliang, Hulk Robot, Dong Aisheng, Shawn Guo
On Tue, Sep 07, 2021 at 08:27:21AM +0900, Nobuhiro Iwamatsu wrote:
> From: Yang Yingliang <yangyingliang@huawei.com>
>
> commit f07ec85365807b3939f32d0094a6dd5ce065d1b9 upstream.
>
> clock source is prepared and enabled by clk_prepare_enable()
> in probe function, but no disable or unprepare in remove and
> error path.
>
> Fixes: 9454a0caff6a ("ARM: imx: add mmdc ipg clock operation for mmdc")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
> Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro1.iwamatsu@toshiba.co.jp>
> ---
> arch/arm/mach-imx/mmdc.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
> index ae0a61c61a6e12..ba830be0b53102 100644
> --- a/arch/arm/mach-imx/mmdc.c
> +++ b/arch/arm/mach-imx/mmdc.c
> @@ -109,6 +109,7 @@ struct mmdc_pmu {
> struct perf_event *mmdc_events[MMDC_NUM_COUNTERS];
> struct hlist_node node;
> struct fsl_mmdc_devtype_data *devtype_data;
> + struct clk *mmdc_ipg_clk;
> };
>
> /*
> @@ -474,11 +475,13 @@ 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);
> iounmap(pmu_mmdc->mmdc_base);
> + clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk);
> kfree(pmu_mmdc);
> return 0;
> }
>
> -static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base)
> +static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base,
> + struct clk *mmdc_ipg_clk)
> {
> struct mmdc_pmu *pmu_mmdc;
> char *name;
> @@ -506,6 +509,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
> }
>
> mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
> + pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
> if (mmdc_num == 0)
> name = "mmdc";
> else
> @@ -579,9 +583,11 @@ static int imx_mmdc_probe(struct platform_device *pdev)
> val &= ~(1 << BP_MMDC_MAPSR_PSD);
> writel_relaxed(val, reg);
>
> - err = imx_mmdc_perf_init(pdev, mmdc_base);
> - if (err)
> + err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk);
> + if (err) {
> iounmap(mmdc_base);
> + clk_disable_unprepare(mmdc_ipg_clk);
> + }
>
> return err;
> }
> --
> 2.33.0
>
>
Both now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-07 13:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 23:27 [PATCH 1/2 for 4.19.y] ARM: imx: add missing clk_disable_unprepare() Nobuhiro Iwamatsu
2021-09-07 13:13 ` Greg KH
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.