From patchwork Tue Apr 26 14:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Gondois X-Patchwork-Id: 566399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21958C433EF for ; Tue, 26 Apr 2022 14:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347436AbiDZOtC (ORCPT ); Tue, 26 Apr 2022 10:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351690AbiDZOtB (ORCPT ); Tue, 26 Apr 2022 10:49:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E051913CE9; Tue, 26 Apr 2022 07:45:53 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ACEE223A; Tue, 26 Apr 2022 07:45:53 -0700 (PDT) Received: from localhost.localdomain (pierre123.nice.arm.com [10.34.129.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BD22D3F73B; Tue, 26 Apr 2022 07:45:50 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: cristian.marussi@arm.com, Ionela.Voinescu@arm.com, Dietmar.Eggemann@arm.com, Pierre Gondois , Pierre Gondois , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Viresh Kumar , Vincent Donnefort , linux-pm@vger.kernel.org Subject: [PATCH v1] PM: EM: Decrement policy counter Date: Tue, 26 Apr 2022 16:44:48 +0200 Message-Id: <20220426144448.43682-1-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Pierre Gondois Fixes: e458716a92b57 ("PM: EM: Mark inefficiencies in CPUFreq") In the above commit, 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. Tested-by: Cristian Marussi Signed-off-by: Pierre Gondois Reviewed-by: Vincent Donnefort --- 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 0153b0ca7b23..6219aaa454b5 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;