From 3ebdc2df40b94d3e27c86ffd708245faf5667ffa Mon Sep 17 00:00:00 2001 From: Avaneesh Kumar Dwivedi Date: Tue, 29 Nov 2022 02:47:08 +0530 Subject: [PATCH] devfreq: memlat: Change number of array elements for holding core_stats Memlat driver allocates as many array elements in core_stats array as many possible cpus While when any of core is not available in between we need to consider what is first and last cpu in possible mask, accordingly initialize the core_stats array. Change-Id: I26420d2b061b712f94c3e496cff12811ea4a678a Signed-off-by: Avaneesh Kumar Dwivedi --- drivers/devfreq/arm-memlat-mon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/devfreq/arm-memlat-mon.c b/drivers/devfreq/arm-memlat-mon.c index 37ebff621d17..4fc8f76918e4 100644 --- a/drivers/devfreq/arm-memlat-mon.c +++ b/drivers/devfreq/arm-memlat-mon.c @@ -907,7 +907,7 @@ static int memlat_mon_probe(struct platform_device *pdev, bool is_compute) } } - num_cpus = cpumask_weight(&mon->cpus); + num_cpus = (cpumask_last(&mon->cpus) - cpumask_first(&mon->cpus)) + 1; hw = &mon->hw; hw->of_node = of_parse_phandle(dev->of_node, "qcom,target-dev", 0);