Skip to content

Commit

Permalink
ARM: imx: add missing iounmap()
Browse files Browse the repository at this point in the history
[ Upstream commit f9613aa ]

Commit e76bdfd ("ARM: imx: Added perf functionality to mmdc driver")
introduced imx_mmdc_remove(), the mmdc_base need be unmapped in it if
config PERF_EVENTS is enabled.

If imx_mmdc_perf_init() fails, the mmdc_base also need be unmapped.

Fixes: e76bdfd ("ARM: imx: Added perf functionality to mmdc driver")
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: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Aug 12, 2021
1 parent 9189d77 commit a28569b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/arm/mach-imx/mmdc.c
Expand Up @@ -462,6 +462,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);
iounmap(pmu_mmdc->mmdc_base);
kfree(pmu_mmdc);
return 0;
}
Expand Down Expand Up @@ -567,7 +568,11 @@ static int imx_mmdc_probe(struct platform_device *pdev)
val &= ~(1 << BP_MMDC_MAPSR_PSD);
writel_relaxed(val, reg);

return imx_mmdc_perf_init(pdev, mmdc_base);
err = imx_mmdc_perf_init(pdev, mmdc_base);
if (err)
iounmap(mmdc_base);

return err;
}

int imx_mmdc_get_ddr_type(void)
Expand Down

0 comments on commit a28569b

Please sign in to comment.