[PATCH v1 1/1] cpufreq: mediatek-hw: Fix double devm_remap in hotplug case
Viresh Kumar
viresh.kumar at linaro.org
Mon Nov 1 20:48:22 PDT 2021
On 29-10-21, 19:42, Hector Yuan wrote:
> From: "Hector.Yuan" <hector.yuan at mediatek.com>
>
> When hotpluging policy cpu, cpu policy init will be called multiple times.
> Unplug CPU7 -> CPU6 -> CPU5 -> CPU4, then plug CPU4 again.
> In this case, devm_remap will double remap and resource allocate fail.
> So replace devm_remap to ioremap and release resources in cpu policy exit.
>
> Signed-off-by: Hector.Yuan <hector.yuan at mediatek.com>
> ---
> drivers/cpufreq/mediatek-cpufreq-hw.c | 33 ++++++++++++++++++++++++++++++---
> 1 file changed, 30 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpufreq/mediatek-cpufreq-hw.c b/drivers/cpufreq/mediatek-cpufreq-hw.c
> index 0cf18dd..25317d7 100644
> --- a/drivers/cpufreq/mediatek-cpufreq-hw.c
> +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c
> @@ -36,6 +36,8 @@ enum {
> struct mtk_cpufreq_data {
> struct cpufreq_frequency_table *table;
> void __iomem *reg_bases[REG_ARRAY_SIZE];
> + struct resource *res;
> + void __iomem *base;
> int nr_opp;
> };
>
> @@ -156,6 +158,7 @@ static int mtk_cpu_resources_init(struct platform_device *pdev,
pdev specific initializations shouldn't be done from policy->init(),
but instead do those only once from mtk_cpufreq_hw_driver_probe().
That way such bugs won't occur again.
--
viresh
More information about the Linux-mediatek
mailing list