From afa4e97e7bb43cf3ad16b1fb5c8533e3f2886197 Mon Sep 17 00:00:00 2001 From: Pierre Gondois Date: Tue, 26 Apr 2022 16:44:48 +0200 Subject: [PATCH] PM: EM: Decrement policy counter [ Upstream commit c9d8923bfbcb63f15ea6cb2b5c8426fc3d96f643 ] In commit e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq"), cpufreq_cpu_get() is called without a cpufreq_cpu_put(), permanently increasing the reference counts of the policy struct. Decrement the reference count once the policy struct is not used anymore. Fixes: e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq") Tested-by: Cristian Marussi Signed-off-by: Pierre Gondois Reviewed-by: Vincent Donnefort Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- kernel/power/energy_model.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index 0153b0ca7b23e..6219aaa454b5b 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -259,6 +259,8 @@ static void em_cpufreq_update_efficiencies(struct device *dev) found++; } + cpufreq_cpu_put(policy); + if (!found) return; -- 2.47.3