* [PATCH -next 0/2] ARM: imx: free resources in imx_mmdc_remove() @ 2021-05-24 7:06 Yang Yingliang 2021-05-24 7:06 ` [PATCH -next 1/2] ARM: imx: add missing iounmap() " Yang Yingliang 2021-05-24 7:07 ` [PATCH -next 2/2] ARM: imx: add missing clk_disable_unprepare() " Yang Yingliang 0 siblings, 2 replies; 4+ messages in thread From: Yang Yingliang @ 2021-05-24 7:06 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-imx; +Cc: shawnguo mmdc_base need be unmapped and mmdc_ipg_clk need be disable and unprepared. Yang Yingliang (2): ARM: imx: add missing iounmap() in imx_mmdc_remove() ARM: imx: add missing clk_disable_unprepare() in imx_mmdc_remove() arch/arm/mach-imx/mmdc.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH -next 1/2] ARM: imx: add missing iounmap() in imx_mmdc_remove() 2021-05-24 7:06 [PATCH -next 0/2] ARM: imx: free resources in imx_mmdc_remove() Yang Yingliang @ 2021-05-24 7:06 ` Yang Yingliang 2021-06-12 2:31 ` Shawn Guo 2021-05-24 7:07 ` [PATCH -next 2/2] ARM: imx: add missing clk_disable_unprepare() " Yang Yingliang 1 sibling, 1 reply; 4+ messages in thread From: Yang Yingliang @ 2021-05-24 7:06 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-imx; +Cc: shawnguo mmdc_base need be unmapped in imx_mmdc_remove(). Fixes: e76bdfd7403a ("ARM: imx: Added perf functionality to mmdc driver") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- arch/arm/mach-imx/mmdc.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c index 0dfd0ae7a63d..c313eb1f614c 100644 --- a/arch/arm/mach-imx/mmdc.c +++ b/arch/arm/mach-imx/mmdc.c @@ -77,6 +77,8 @@ static const struct of_device_id imx_mmdc_dt_ids[] = { { /* sentinel */ } }; +static void __iomem *mmdc_base; + #ifdef CONFIG_PERF_EVENTS static enum cpuhp_state cpuhp_mmdc_state; @@ -456,16 +458,6 @@ static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc, return mmdc_num; } -static int imx_mmdc_remove(struct platform_device *pdev) -{ - struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev); - - cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); - perf_pmu_unregister(&pmu_mmdc->pmu); - kfree(pmu_mmdc); - return 0; -} - static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base) { struct mmdc_pmu *pmu_mmdc; @@ -528,14 +520,26 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b } #else -#define imx_mmdc_remove NULL #define imx_mmdc_perf_init(pdev, mmdc_base) 0 #endif +static int imx_mmdc_remove(struct platform_device *pdev) +{ +#ifdef CONFIG_PERF_EVENTS + struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev); + + cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); + perf_pmu_unregister(&pmu_mmdc->pmu); + kfree(pmu_mmdc); +#endif + iounmap(mmdc_base); + return 0; +} + static int imx_mmdc_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - void __iomem *mmdc_base, *reg; + void *reg; struct clk *mmdc_ipg_clk; u32 val; int err; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next 1/2] ARM: imx: add missing iounmap() in imx_mmdc_remove() 2021-05-24 7:06 ` [PATCH -next 1/2] ARM: imx: add missing iounmap() " Yang Yingliang @ 2021-06-12 2:31 ` Shawn Guo 0 siblings, 0 replies; 4+ messages in thread From: Shawn Guo @ 2021-06-12 2:31 UTC (permalink / raw) To: Yang Yingliang; +Cc: linux-kernel, linux-arm-kernel, linux-imx On Mon, May 24, 2021 at 03:06:59PM +0800, Yang Yingliang wrote: > mmdc_base need be unmapped in imx_mmdc_remove(). > > Fixes: e76bdfd7403a ("ARM: imx: Added perf functionality to mmdc driver") > Reported-by: Hulk Robot <hulkci@huawei.com> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> > --- > arch/arm/mach-imx/mmdc.c | 28 ++++++++++++++++------------ > 1 file changed, 16 insertions(+), 12 deletions(-) > > diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c > index 0dfd0ae7a63d..c313eb1f614c 100644 > --- a/arch/arm/mach-imx/mmdc.c > +++ b/arch/arm/mach-imx/mmdc.c > @@ -77,6 +77,8 @@ static const struct of_device_id imx_mmdc_dt_ids[] = { > { /* sentinel */ } > }; > > +static void __iomem *mmdc_base; > + I do not like such variables. Can we have a data structure holding this and the clock that patch 2/2 is adding? Also please consider to consolidate the mmdc_base in' struct mmdc_pmu'. Shawn > #ifdef CONFIG_PERF_EVENTS > > static enum cpuhp_state cpuhp_mmdc_state; > @@ -456,16 +458,6 @@ static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc, > return mmdc_num; > } > > -static int imx_mmdc_remove(struct platform_device *pdev) > -{ > - struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev); > - > - cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); > - perf_pmu_unregister(&pmu_mmdc->pmu); > - kfree(pmu_mmdc); > - return 0; > -} > - > static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base) > { > struct mmdc_pmu *pmu_mmdc; > @@ -528,14 +520,26 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b > } > > #else > -#define imx_mmdc_remove NULL > #define imx_mmdc_perf_init(pdev, mmdc_base) 0 > #endif > > +static int imx_mmdc_remove(struct platform_device *pdev) > +{ > +#ifdef CONFIG_PERF_EVENTS > + struct mmdc_pmu *pmu_mmdc = platform_get_drvdata(pdev); > + > + cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); > + perf_pmu_unregister(&pmu_mmdc->pmu); > + kfree(pmu_mmdc); > +#endif > + iounmap(mmdc_base); > + return 0; > +} > + > static int imx_mmdc_probe(struct platform_device *pdev) > { > struct device_node *np = pdev->dev.of_node; > - void __iomem *mmdc_base, *reg; > + void *reg; > struct clk *mmdc_ipg_clk; > u32 val; > int err; > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH -next 2/2] ARM: imx: add missing clk_disable_unprepare() in imx_mmdc_remove() 2021-05-24 7:06 [PATCH -next 0/2] ARM: imx: free resources in imx_mmdc_remove() Yang Yingliang 2021-05-24 7:06 ` [PATCH -next 1/2] ARM: imx: add missing iounmap() " Yang Yingliang @ 2021-05-24 7:07 ` Yang Yingliang 1 sibling, 0 replies; 4+ messages in thread From: Yang Yingliang @ 2021-05-24 7:07 UTC (permalink / raw) To: linux-kernel, linux-arm-kernel, linux-imx; +Cc: shawnguo 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") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- arch/arm/mach-imx/mmdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c index c313eb1f614c..9de929f8cf6c 100644 --- a/arch/arm/mach-imx/mmdc.c +++ b/arch/arm/mach-imx/mmdc.c @@ -78,6 +78,7 @@ static const struct of_device_id imx_mmdc_dt_ids[] = { }; static void __iomem *mmdc_base; +static struct clk *mmdc_ipg_clk; #ifdef CONFIG_PERF_EVENTS @@ -533,6 +534,7 @@ static int imx_mmdc_remove(struct platform_device *pdev) kfree(pmu_mmdc); #endif iounmap(mmdc_base); + clk_disable_unprepare(mmdc_ipg_clk); return 0; } @@ -540,7 +542,6 @@ static int imx_mmdc_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; void *reg; - struct clk *mmdc_ipg_clk; u32 val; int err; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-12 2:33 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-24 7:06 [PATCH -next 0/2] ARM: imx: free resources in imx_mmdc_remove() Yang Yingliang 2021-05-24 7:06 ` [PATCH -next 1/2] ARM: imx: add missing iounmap() " Yang Yingliang 2021-06-12 2:31 ` Shawn Guo 2021-05-24 7:07 ` [PATCH -next 2/2] ARM: imx: add missing clk_disable_unprepare() " Yang Yingliang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).