From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7D092FF169; Mon, 1 Sep 2025 08:58:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717100; cv=none; b=AHP3IkjtP7B2YKwI+y/G5BaYh5fd74F6hXMT3whoLAw/6L4+z1h8m0vMGApVb9NRKOEVqGC9FU1wHa7Or1BzslKvVwEyORGGBySSHeeDBjbCdXzXXt+bvueye5pg6gS6lkeExWNYqoGIMk+4XZVMB2muqDpsAgMgRFnCvUFA6to= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717100; c=relaxed/simple; bh=rIzTeYbAacMjDG3q4zjkvaLrB5sJIcgoqQE8afvCSKg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YBkipYqn6VZ8xD0GcEWmi1hiFQs3TdAAFGdKLjllFgq4mTqJb15FmWCisi6AefK6A2AJkkuO0XWEp8C4rdtksA/szuq0oTCo9gOZ8LdFWXwBSq8qudNomtuQaDzybXShH4qO7WBMOSNAY92KZaNTDVEnjy6G9JbQhlXbIvOIxyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: c7ef96b8871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:6d13546f-8429-4618-a1c3-1481c587b2a4,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:bdf8f6555902ff4aa82c4fdfd0209733,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: c7ef96b8871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 95500762; Mon, 01 Sep 2025 16:58:08 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id E1EACE008FA6; Mon, 1 Sep 2025 16:58:06 +0800 (CST) X-ns-mid: postfix-68B5601E-556482735 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id D540EE008FA8; Mon, 1 Sep 2025 16:58:02 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 01/12] arm64: topology: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:37 +0800 Message-Id: <20250901085748.36795-2-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- arch/arm64/kernel/topology.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 5d07ee85bdae..fa0980968f45 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -307,17 +307,16 @@ int arch_freq_get_on_cpu(int cpu) */ if (!housekeeping_cpu(cpu, HK_TYPE_TICK) || time_is_before_jiffies(last_update + msecs_to_jiffies(AMU_SAMPLE_EXP= _MS))) { - struct cpufreq_policy *policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(info->opp_cpu); int ref_cpu; =20 if (!policy) return -EINVAL; =20 if (!cpumask_intersects(policy->related_cpus, - housekeeping_cpumask(HK_TYPE_TICK))) { - cpufreq_cpu_put(policy); + housekeeping_cpumask(HK_TYPE_TICK))) return -EOPNOTSUPP; - } =20 for_each_cpu_wrap(ref_cpu, policy->cpus, cpu + 1) { if (ref_cpu =3D=3D start_cpu) { @@ -329,8 +328,6 @@ int arch_freq_get_on_cpu(int cpu) break; } =20 - cpufreq_cpu_put(policy); - if (ref_cpu >=3D nr_cpu_ids) /* No alternative to pull info from */ return -EAGAIN; --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 961652FB626; Mon, 1 Sep 2025 08:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717102; cv=none; b=evnpKxB8oZmzR+nRKt67J4ApPCFCCnwD0H/OIi3PxCoIPgJ34J9JHVIdlw2h3RdKYcJp2qLD9u0i4GCW4iUAURKiDGR9A30X30I5G7aM4QyJrX7oxaueqOedpso8jv/ne+ClBy5QidbT7mfcJ5RLFhHfqQlV/ZFqOBPSQvf78kM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717102; c=relaxed/simple; bh=9RC4xM37d9hqvphdVz6qwGbgCeK6UHMssRCph8J8IM4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HlJRWbZntXAKoXLwTyziWAY5/+3thRdiBlWTEGJedi9oKkZXRWiwJGags9XFPCkmLeEhns0KEJK8oV3nrWJo45vpUc/BZOj7Cm3S1TaMgubrn2Bwb4bfZR024tfNyVo6LJixoO2VC4cYp5Dd/MAlKs6Z96xxM1gd4irZNQNOqkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: c9b1c00c871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:9c8abea4-fa85-4f70-8053-8228d0bd40fc,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:af33568b0772d3dc82685951b3e91b37,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: c9b1c00c871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 235447165; Mon, 01 Sep 2025 16:58:11 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 4B3D7E008FA6; Mon, 1 Sep 2025 16:58:11 +0800 (CST) X-ns-mid: postfix-68B56023-128246736 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id F1DFEE008FA7; Mon, 1 Sep 2025 16:58:06 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 02/12] ACPI: processor: thermal: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:38 +0800 Message-Id: <20250901085748.36795-3-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/acpi/processor_thermal.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_ther= mal.c index 1219adb11ab9..3c8b57df9619 100644 --- a/drivers/acpi/processor_thermal.c +++ b/drivers/acpi/processor_thermal.c @@ -62,19 +62,14 @@ static int phys_package_first_cpu(int cpu) return 0; } =20 -static int cpu_has_cpufreq(unsigned int cpu) +static bool cpu_has_cpufreq(unsigned int cpu) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(cpu); =20 if (!acpi_processor_cpufreq_init) return 0; =20 - policy =3D cpufreq_cpu_get(cpu); - if (policy) { - cpufreq_cpu_put(policy); - return 1; - } - return 0; + return !!policy; } =20 static int cpufreq_get_max_state(unsigned int cpu) @@ -95,7 +90,6 @@ static int cpufreq_get_cur_state(unsigned int cpu) =20 static int cpufreq_set_cur_state(unsigned int cpu, int state) { - struct cpufreq_policy *policy; struct acpi_processor *pr; unsigned long max_freq; int i, ret; @@ -111,6 +105,9 @@ static int cpufreq_set_cur_state(unsigned int cpu, int = state) * frequency. */ for_each_online_cpu(i) { + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(i); + if (topology_physical_package_id(i) !=3D topology_physical_package_id(cpu)) continue; @@ -120,15 +117,12 @@ static int cpufreq_set_cur_state(unsigned int cpu, in= t state) if (unlikely(!freq_qos_request_active(&pr->thermal_req))) continue; =20 - policy =3D cpufreq_cpu_get(i); if (!policy) return -EINVAL; =20 max_freq =3D (policy->cpuinfo.max_freq * (100 - reduction_step(i) * cpufreq_thermal_reduction_pctg)) / 100; =20 - cpufreq_cpu_put(policy); - ret =3D freq_qos_update_request(&pr->thermal_req, max_freq); if (ret < 0) { pr_warn("Failed to update thermal freq constraint: CPU%d (%d)\n", --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AE592FFDCB; Mon, 1 Sep 2025 08:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717103; cv=none; b=V7sM0zvg5BgSaqbfppcHnhybjbuLfLwPkytcgSX1DCZHt5GDu3yYCXjZG8tZUCF+w4iTaGfZBo0RPUHXMo7p94J5BOc9ZpNolQltRwsUYa+63vAZ0q7941QaZnmGcm3QjnBsI4S+otUy/AGIWUPhNnOYWJVPYFppvLEqAKp8d2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717103; c=relaxed/simple; bh=xP0ro2aix8c/KGwDyv8+HIqQ00m32Qa6AwzM7PiOa28=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PhXhM611mgYbZl0UEoCVmXiO6QSDjfaZrJ6cg4UiL09PnAIhrGcgnMEPXW/I+eUOGSg9X7bVZqdhIhJ6W2QN3GMCvl+aCupAY3q2jUjb1ErqevJC39DBB701kN8Hp87JmF4zTKSnlt3ep0FOJfZLDX45ya7g1PyPLQhOAQ5jPi4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: cc00f31e871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:d6133662-2e5b-4c23-8ba5-17fca22ffc9e,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:71ad1ccc093c0f7fefa7e242163419af,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: cc00f31e871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1338269176; Mon, 01 Sep 2025 16:58:15 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 278F5E008FA6; Mon, 1 Sep 2025 16:58:15 +0800 (CST) X-ns-mid: postfix-68B56026-958754737 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 572A7E008FA7; Mon, 1 Sep 2025 16:58:11 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 03/12] cpufreq: intel_pstate: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:39 +0800 Message-Id: <20250901085748.36795-4-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/cpufreq/intel_pstate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f366d35c5840..4abc1ef2d2b0 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -1502,9 +1502,8 @@ static void __intel_pstate_update_max_freq(struct cpu= freq_policy *policy, =20 static bool intel_pstate_update_max_freq(struct cpudata *cpudata) { - struct cpufreq_policy *policy __free(put_cpufreq_policy); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(cpudata->cpu); =20 - policy =3D cpufreq_cpu_get(cpudata->cpu); if (!policy) return false; =20 @@ -1698,19 +1697,18 @@ static ssize_t store_no_turbo(struct kobject *a, st= ruct kobj_attribute *b, static void update_qos_request(enum freq_qos_req_type type) { struct freq_qos_request *req; - struct cpufreq_policy *policy; int i; =20 for_each_possible_cpu(i) { struct cpudata *cpu =3D all_cpu_data[i]; unsigned int freq, perf_pct; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(i); =20 - policy =3D cpufreq_cpu_get(i); if (!policy) continue; =20 req =3D policy->driver_data; - cpufreq_cpu_put(policy); =20 if (!req) continue; --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 677E33009D3; Mon, 1 Sep 2025 08:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717105; cv=none; b=qFa40RLhCHZfnuKvpB04Ty4eh/VhSqZ4iXtAPlGIdeLptMOgPgBPT2onvHO9VIsIpR7JF2fQC2LyrYWgXvxYt5dhFtwJXomyP/6PzQL4Xy1jtcOTcXiVPniSmjzTBwoDIu23JEjIHwSu3waaqmZX60r8YMTfssVQONNRRG2ZI1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717105; c=relaxed/simple; bh=rkwb4IeMY1GAAMkcKNNGOUfz988DBM38McQun8BvQ2w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XrU/gn6//uaZLIjFgQTCzzHNnyrfBaCgPj989owXRkYQ6nPNOo3nKNSVtvafWga+kfqBjrUFwp8FCMQf5YiuEkKa+UnMXVftY7Y1SPCNEaY9og+5sgGiiQEfQgDlPqCxCw8KCwBJqtf36nF9Hdv8d3gBnqsZ9eszcbU71k+Hku8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: ce45fcaa871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:32ec79ce-b7fb-486c-a29f-ba035ebc7973,IP:0,U RL:0,TC:0,Content:26,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:26 X-CID-META: VersionHash:6493067,CLOUDID:54a8b82e8127115c930df8f8935c7019,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: ce45fcaa871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1426818083; Mon, 01 Sep 2025 16:58:19 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id EBB6FE008FA7; Mon, 1 Sep 2025 16:58:18 +0800 (CST) X-ns-mid: postfix-68B5602A-782193739 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 33CF0E008FA8; Mon, 1 Sep 2025 16:58:15 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 04/12] cpufreq: longhaul: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:40 +0800 Message-Id: <20250901085748.36795-5-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/cpufreq/longhaul.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index ba0e08c8486a..ae5596919671 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -950,7 +950,7 @@ static int __init longhaul_init(void) =20 static void __exit longhaul_exit(void) { - struct cpufreq_policy *policy =3D cpufreq_cpu_get(0); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(0); int i; =20 for (i =3D 0; i < numscales; i++) { @@ -968,7 +968,6 @@ static void __exit longhaul_exit(void) } } =20 - cpufreq_cpu_put(policy); cpufreq_unregister_driver(&longhaul_driver); kfree(longhaul_table); } --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CCBC2FF15F; Mon, 1 Sep 2025 08:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717117; cv=none; b=TulNGYtJmPQ4JW5sKE/VjaYlLXiDbbiDWZYwmlbC/By0BYHvsz2DOFL5SXisBPTrNWu8lIG/yzDIqoYL86Ce3JgBvLGnD1RH1kCwybtzZjBHQQ/oEw9pSND1VJ1xG8GwfdqO0k1EjvzxGsbW7g64t3js3PF+YnRZAi9Trf/xoJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717117; c=relaxed/simple; bh=25xihmgNFYPtSP4uZbH8/sjypxcxoQ7omwmmQUSgg98=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IJfrYgKbDVGhnXyJm5T3z7y4pQKn3gMQsQOjXDgmsAZF2sW7OtDBn06W9K7BoCHRYndon7tIfOXFoS6SpeUNUAs96zU21D6n4p8B2c2W/pm5yGIwE66Ws5Zk4YPAx8bKMznVWjFtI4++rAwepGtIZJBiU/LgC+cf2wF/TgwfsSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: d3d01002871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:91218b6e-7623-4861-8c97-36b43e2f0e7e,IP:0,U RL:0,TC:0,Content:38,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:38 X-CID-META: VersionHash:6493067,CLOUDID:f0135f5c24c77514b6cdf0eea2f8050c,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:4|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: d3d01002871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1713458472; Mon, 01 Sep 2025 16:58:28 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 092DCE008FA7; Mon, 1 Sep 2025 16:58:28 +0800 (CST) X-ns-mid: postfix-68B5602E-667223740 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 03A5FE008FAA; Mon, 1 Sep 2025 16:58:18 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 05/12] cpufreq: powernv: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:41 +0800 Message-Id: <20250901085748.36795-6-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/cpufreq/powernv-cpufreq.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cp= ufreq.c index 7d9a5f656de8..811fdbf398fa 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -892,15 +892,15 @@ static int powernv_cpufreq_reboot_notifier(struct not= ifier_block *nb, unsigned long action, void *unused) { int cpu; - struct cpufreq_policy *cpu_policy; =20 rebooting =3D true; for_each_online_cpu(cpu) { - cpu_policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(cpu); + if (!cpu_policy) continue; powernv_cpufreq_target_index(cpu_policy, get_nominal_index()); - cpufreq_cpu_put(cpu_policy); } =20 return NOTIFY_DONE; @@ -913,7 +913,6 @@ static struct notifier_block powernv_cpufreq_reboot_nb = =3D { static void powernv_cpufreq_work_fn(struct work_struct *work) { struct chip *chip =3D container_of(work, struct chip, throttle); - struct cpufreq_policy *policy; unsigned int cpu; cpumask_t mask; =20 @@ -928,14 +927,14 @@ static void powernv_cpufreq_work_fn(struct work_struc= t *work) chip->restore =3D false; for_each_cpu(cpu, &mask) { int index; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(cpu); =20 - policy =3D cpufreq_cpu_get(cpu); if (!policy) continue; index =3D cpufreq_table_find_index_c(policy, policy->cur, false); powernv_cpufreq_target_index(policy, index); cpumask_andnot(&mask, &mask, policy->cpus); - cpufreq_cpu_put(policy); } out: cpus_read_unlock(); --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96F492FF15D; Mon, 1 Sep 2025 08:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717118; cv=none; b=ldP4wpKI4IQ/ZPykYwvI/W9TjshJmBdRp0tVD5Hrja4x4x3eTVIyGIADk1+QGeczFbd4DOPf1BvQhcq/dN28+kR6tc9MWa+okAQtxtjyKytvZ4K4ZdBUUXoQrJ7IfR2Uf9DqHdaNgjDkXb8LihZfykYF35TYkNgLERBK2PnyKks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717118; c=relaxed/simple; bh=6PsNSJA12rQtQ1XvZDJQx6WZz6bBmX6iNEjUN6S7Ojw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dE2nQM2DFmjRotSKdmJcy9w578qDELfgzhaDPKNcS9nR/Q2R50lnw01HpHEtqpwzOvFDDFqDDb6BRnuzuFw1grS/zNsv21abQtnqa9f/9dvm/1qwHV+ipx6DUgxIPJDoXm6pBsH9qbw9uOcS3rRiq44d7UnPHL5XRE96hfLNnaA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: d409ed04871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:d8480e87-b59a-47eb-81a8-7af7c0827343,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:76fb4ce374fb73e2a140740899724919,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: d409ed04871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1893902058; Mon, 01 Sep 2025 16:58:29 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 6330EE008FA8; Mon, 1 Sep 2025 16:58:28 +0800 (CST) X-ns-mid: postfix-68B56034-203598742 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 99AA3E008FAB; Mon, 1 Sep 2025 16:58:24 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 06/12] PM / devfreq: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:42 +0800 Message-Id: <20250901085748.36795-7-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/devfreq/governor_passive.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_= passive.c index 953cf9a1e9f7..a035cf44bdb8 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -80,24 +80,23 @@ static int get_target_freq_with_cpufreq(struct devfreq = *devfreq, struct devfreq_passive_data *p_data =3D (struct devfreq_passive_data *)devfreq->data; struct devfreq_cpu_data *parent_cpu_data; - struct cpufreq_policy *policy; unsigned long cpu, cpu_cur, cpu_min, cpu_max, cpu_percent; unsigned long dev_min, dev_max; unsigned long freq =3D 0; int ret =3D 0; =20 for_each_online_cpu(cpu) { - policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(cpu); + if (!policy) { ret =3D -EINVAL; continue; } =20 parent_cpu_data =3D get_parent_cpu_data(p_data, policy); - if (!parent_cpu_data) { - cpufreq_cpu_put(policy); + if (!parent_cpu_data) continue; - } =20 /* Get target freq via required opps */ cpu_cur =3D parent_cpu_data->cur_freq * HZ_PER_KHZ; @@ -106,7 +105,6 @@ static int get_target_freq_with_cpufreq(struct devfreq = *devfreq, devfreq->opp_table, &cpu_cur); if (freq) { *target_freq =3D max(freq, *target_freq); - cpufreq_cpu_put(policy); continue; } =20 @@ -121,7 +119,6 @@ static int get_target_freq_with_cpufreq(struct devfreq = *devfreq, freq =3D dev_min + mult_frac(dev_max - dev_min, cpu_percent, 100); =20 *target_freq =3D max(freq, *target_freq); - cpufreq_cpu_put(policy); } =20 return ret; @@ -256,7 +253,6 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) struct device *dev =3D devfreq->dev.parent; struct opp_table *opp_table =3D NULL; struct devfreq_cpu_data *parent_cpu_data; - struct cpufreq_policy *policy; struct device *cpu_dev; unsigned int cpu; int ret; @@ -273,23 +269,23 @@ static int cpufreq_passive_register_notifier(struct d= evfreq *devfreq) } =20 for_each_possible_cpu(cpu) { - policy =3D cpufreq_cpu_get(cpu); + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(cpu); + if (!policy) { ret =3D -EPROBE_DEFER; goto err; } =20 parent_cpu_data =3D get_parent_cpu_data(p_data, policy); - if (parent_cpu_data) { - cpufreq_cpu_put(policy); + if (parent_cpu_data) continue; - } =20 parent_cpu_data =3D kzalloc(sizeof(*parent_cpu_data), GFP_KERNEL); if (!parent_cpu_data) { ret =3D -ENOMEM; - goto err_put_policy; + goto err; } =20 cpu_dev =3D get_cpu_device(cpu); @@ -314,7 +310,6 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) parent_cpu_data->max_freq =3D policy->cpuinfo.max_freq; =20 list_add_tail(&parent_cpu_data->node, &p_data->cpu_data_list); - cpufreq_cpu_put(policy); } =20 mutex_lock(&devfreq->lock); @@ -327,8 +322,6 @@ static int cpufreq_passive_register_notifier(struct dev= freq *devfreq) =20 err_free_cpu_data: kfree(parent_cpu_data); -err_put_policy: - cpufreq_cpu_put(policy); err: =20 return ret; --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76AF53019C6; Mon, 1 Sep 2025 08:58:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717120; cv=none; b=XPfM/XUlh0l63qYE768HYtTrUI6eA5vviHgpL828V+wI5e3JsmVjKm25TnkPboqzxzP9Fno5tP2w1hCmDDnuVLr10NBuGDJb3mYbkMjnw/HEm5YvwvhAPWwAETln0jE81M1UD6iAADMexnDjtfAGZd+PSPFM8A4971rGH4DjbLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717120; c=relaxed/simple; bh=nL9uXlexQDC6CbrMTnH0B+Ysx+pDvLQ1rB8sOE0bEcY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YptFyvKYMfMH9MiqsCSUIE5cODADS1+aXZFGKCPhcS0iV9CLBhnHxjvu0p2yD59wkPf4qv1HwZJXWD8d1DbMpzcPlVU8PwVeMC0Cay2RgZW0enTIxw5s4D/1F3YFFuAVe1OsTIZr3tvhFz1hPTVXGNkamhCMFqhLLzdmJ3u66e4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: d644f14a871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:bd3b8266-8573-448a-b72f-1ec5d0220522,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:c9315f1ffc089d33de71e119d1e21f59,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: d644f14a871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 640016447; Mon, 01 Sep 2025 16:58:32 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 28B95E008FA7; Mon, 1 Sep 2025 16:58:32 +0800 (CST) X-ns-mid: postfix-68B56037-986048743 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 6E0E2E008FAA; Mon, 1 Sep 2025 16:58:28 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 07/12] drm/i915: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:43 +0800 Message-Id: <20250901085748.36795-8-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/gpu/drm/i915/gt/intel_llc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_llc.c b/drivers/gpu/drm/i915/gt/= intel_llc.c index 1d19c073ba2e..f15e4c0fa54b 100644 --- a/drivers/gpu/drm/i915/gt/intel_llc.c +++ b/drivers/gpu/drm/i915/gt/intel_llc.c @@ -29,13 +29,11 @@ static struct intel_gt *llc_to_gt(struct intel_llc *llc) =20 static unsigned int cpu_max_MHz(void) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(0); unsigned int max_khz; =20 - policy =3D cpufreq_cpu_get(0); if (policy) { max_khz =3D policy->cpuinfo.max_freq; - cpufreq_cpu_put(policy); } else { /* * Default to measured freq if none found, PCU will ensure we --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7E2B2FFDCC; Mon, 1 Sep 2025 08:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717126; cv=none; b=gqIA293WOpu9QKMaCym4RRFBnFlLatsJMgdIroDveN40yB9FnU46cLUR0hxuyFrmI4QXwJDBakEr/sp38hnExNacOf7Wk2lCgRarmBVj+R0W97b2NYCTCyIUHJHLfAfDbL5MfOKE/83hKHZzKov5a/pNBd0AnnJ/0rDMoGgB1rA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717126; c=relaxed/simple; bh=QppcMyPWSg0d5SpnAN0GyeWKrCIaeNfu4Ty8CaOZibc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QzTyhZQWkk3hMR+quCDyMQKRjnTvqc4+WzUA4kQZqf3dKWI9IVimKbZUpZPol0g91nv+3fk8mp31HBdXo8Lu9VvxxApjBYO2GPz+83ZNwzl/ukRBTG6MF6+R6bhToQugvxwlzf+iDGL8qG80Jc20wCykPsuKPzMtPvZOHYI8VtE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: d88a416c871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:f0312209-cc58-49da-b2fe-bd1490843f15,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:cb619b8137095f381006df9a56b13c38,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: d88a416c871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 155411594; Mon, 01 Sep 2025 16:58:36 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id EEA53E008FAB; Mon, 1 Sep 2025 16:58:35 +0800 (CST) X-ns-mid: postfix-68B5603B-776156745 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 344EFE008FA8; Mon, 1 Sep 2025 16:58:32 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 08/12] cpufreq: powerpc: macintosh: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:44 +0800 Message-Id: <20250901085748.36795-9-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/macintosh/windfarm_cpufreq_clamp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/macintosh/windfarm_cpufreq_clamp.c b/drivers/macintosh= /windfarm_cpufreq_clamp.c index 28d18ef22bbb..08558756990b 100644 --- a/drivers/macintosh/windfarm_cpufreq_clamp.c +++ b/drivers/macintosh/windfarm_cpufreq_clamp.c @@ -62,12 +62,11 @@ static const struct wf_control_ops clamp_ops =3D { =20 static int __init wf_cpufreq_clamp_init(void) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(0); struct wf_control *clamp; struct device *dev; int ret; =20 - policy =3D cpufreq_cpu_get(0); if (!policy) { pr_warn("%s: cpufreq policy not found cpu0\n", __func__); return -EPROBE_DEFER; @@ -79,8 +78,6 @@ static int __init wf_cpufreq_clamp_init(void) ret =3D freq_qos_add_request(&policy->constraints, &qos_req, FREQ_QOS_MAX, max_freq); =20 - cpufreq_cpu_put(policy); - if (ret < 0) { pr_err("%s: Failed to add freq constraint (%d)\n", __func__, ret); --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AA02303CA3; Mon, 1 Sep 2025 08:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717129; cv=none; b=RdRqER8b05ySl4wa/wWjscMlbzjjL8TnJQLlIPYRpqLluLLz/o5oDOnO/vJg7zZz6wIIFjrYAzii/pT0S+VZAYzSHLhiEkvEAbWaulihKOMrvVVQgM2YDRi3xY+OsFc+0ya3A4DfKQXK3TVi2yVFHe/oc1rkPrt54RTeV8zR57Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717129; c=relaxed/simple; bh=dhRBsLKCue9ObsMIGwVkWRLFYlImG5IC33OnzpcGm8o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J5XuDeGk9RDcb7xMAA8tCjgbisCv3BjgjN9z1YRhtSD40byKcl2h3OJQp+l7e1MGA70bTIhgu5aVmn4mCidDEo4SliqnL4ACBHN9b6PhktQ6p9Hcey2zA+lWl1h6vTtUfoQkBU62ZnTTjMuwpqPGttJfhlT5xqpzI6z8tvV3QuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: dab7a34e871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:bed9fbe2-11d3-4407-afe8-1156de4cb1de,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:b623ff232d1ac7c6941a48d46afe61b6,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: dab7a34e871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 480119038; Mon, 01 Sep 2025 16:58:40 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id CD393E008FA8; Mon, 1 Sep 2025 16:58:39 +0800 (CST) X-ns-mid: postfix-68B5603F-551072746 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 0422BE008FAC; Mon, 1 Sep 2025 16:58:35 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 09/12] powercap: dtpm_cpu: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:45 +0800 Message-Id: <20250901085748.36795-10-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/powercap/dtpm_cpu.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index 99390ec1481f..5e18438782f8 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -144,19 +144,15 @@ static int update_pd_power_uw(struct dtpm *dtpm) static void pd_release(struct dtpm *dtpm) { struct dtpm_cpu *dtpm_cpu =3D to_dtpm_cpu(dtpm); - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(dtpm_cpu->cpu); =20 if (freq_qos_request_active(&dtpm_cpu->qos_req)) freq_qos_remove_request(&dtpm_cpu->qos_req); =20 - policy =3D cpufreq_cpu_get(dtpm_cpu->cpu); - if (policy) { + if (policy) for_each_cpu(dtpm_cpu->cpu, policy->related_cpus) per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) =3D NULL; =20 - cpufreq_cpu_put(policy); - } - kfree(dtpm_cpu); } =20 @@ -192,7 +188,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) { struct dtpm_cpu *dtpm_cpu; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(cpu); struct em_perf_state *table; struct em_perf_domain *pd; char name[CPUFREQ_NAME_LEN]; @@ -202,21 +198,16 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *par= ent) if (dtpm_cpu) return 0; =20 - policy =3D cpufreq_cpu_get(cpu); if (!policy) return 0; =20 pd =3D em_cpu_get(cpu); - if (!pd || em_is_artificial(pd)) { - ret =3D -EINVAL; - goto release_policy; - } + if (!pd || em_is_artificial(pd)) + return -EINVAL; =20 dtpm_cpu =3D kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); - if (!dtpm_cpu) { - ret =3D -ENOMEM; - goto release_policy; - } + if (!dtpm_cpu) + return -ENOMEM; =20 dtpm_init(&dtpm_cpu->dtpm, &dtpm_ops); dtpm_cpu->cpu =3D cpu; @@ -239,7 +230,6 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *paren= t) if (ret < 0) goto out_dtpm_unregister; =20 - cpufreq_cpu_put(policy); return 0; =20 out_dtpm_unregister: @@ -251,8 +241,6 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *paren= t) per_cpu(dtpm_per_cpu, cpu) =3D NULL; kfree(dtpm_cpu); =20 -release_policy: - cpufreq_cpu_put(policy); return ret; } =20 --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B657E3043BE; Mon, 1 Sep 2025 08:58:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717132; cv=none; b=IRJmy+6q0zyZSFrRYkgxW12hgFF+9kPArRZlvCrIbjTCprzG/TZgVTdt9Czld32kZRbysRaghywQPwJIeihWFwJZfHwt1g4gGeSpgPQtvOoX6GsPSRMjVTkC+h75J/3AWiPJ7gTFdE5Em2LuAES/CqLYOgIwDCP6h1AJNkFinCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717132; c=relaxed/simple; bh=F02wtNB+VGs3bpNZI8pCdS0Babn7eRvQHvbb7L0Vy/0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A/We4HFntOW1jA0k/P1huj8bAsUxjclVNlcpZt7KKWa9WQT0/tjd4Wv1GSgPEjOWs430bk2dkakJASNwoLmfAEIw8GqD8kZPzSLSHy7GaYdqpuNZwb7caqwD7wgOoRgFaRtAhfo1cPfA/2Db7nkrxITpgrDz7n+CpBS7MC6gKag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: dd0b02c6871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:46c283cc-b5bb-46ec-a1f7-907896491998,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:d27fee2e8a6b06d9cbfaef5d3190c03b,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: dd0b02c6871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 793860202; Mon, 01 Sep 2025 16:58:44 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 86233E008FA5; Mon, 1 Sep 2025 16:58:43 +0800 (CST) X-ns-mid: postfix-68B56043-381034747 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id BDA8EE008FA7; Mon, 1 Sep 2025 16:58:39 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 10/12] thermal: imx: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:46 +0800 Message-Id: <20250901085748.36795-11-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/thermal/imx_thermal.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 38c993d1bcb3..8d5fd5ca39da 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -201,7 +201,6 @@ static struct thermal_soc_data thermal_imx7d_data =3D { =20 struct imx_thermal_data { struct device *dev; - struct cpufreq_policy *policy; struct thermal_zone_device *tz; struct thermal_cooling_device *cdev; struct regmap *tempmon; @@ -541,22 +540,20 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match); static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *da= ta) { struct device_node *np; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(0); int ret =3D 0; =20 - data->policy =3D cpufreq_cpu_get(0); - if (!data->policy) { + if (!policy) { pr_debug("%s: CPUFreq policy not found\n", __func__); return -EPROBE_DEFER; } =20 - np =3D of_get_cpu_node(data->policy->cpu, NULL); + np =3D of_get_cpu_node(policy->cpu, NULL); =20 if (!np || !of_property_present(np, "#cooling-cells")) { data->cdev =3D cpufreq_cooling_register(data->policy); - if (IS_ERR(data->cdev)) { + if (IS_ERR(data->cdev)) ret =3D PTR_ERR(data->cdev); - cpufreq_cpu_put(data->policy); - } } =20 of_node_put(np); @@ -567,7 +564,6 @@ static int imx_thermal_register_legacy_cooling(struct i= mx_thermal_data *data) static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data = *data) { cpufreq_cooling_unregister(data->cdev); - cpufreq_cpu_put(data->policy); } =20 #else --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A00592FFDF1; Mon, 1 Sep 2025 08:58:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717140; cv=none; b=rhYCKa8b+MI3K2/ruwEy16HmFGQIqeIpWwROUaQ4BwrZJrWtnlV9YWggu0QTeV606FyPhrpdy0EBCnWBvO3CRp/UdXvJL7+qvy/sX6x67DSkEjjPFLcTYBWqsQWXYTHlbuF99aJhmvbUfPEeShws23GAS2yNm38pC8yoYiqlFrg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717140; c=relaxed/simple; bh=v743MoZEKCT/HOysrU4k4DYsQROpAeffJY8mUvn7Yd8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jOiEqnaLRtHOAGLhw6Yx53/CCKAsBzz5YP6GvLXwbnVuvNfKRuNvAd52TwZh1Pb9fSrOx4NBZSvjuOWJwtZkdKeGjIXAfGu92D6s11h2ZMdy3e8GNzEI3wXmixG1gpEil2KT58GmZgGNTq8054/VE86HO0ob+OGrdp41CtGGgHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: e2624004871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:084774f6-4f27-4563-9c15-27e02553a790,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6493067,CLOUDID:bf6960de0fea4d96f52c7ed05c9793fa,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: e2624004871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1064011897; Mon, 01 Sep 2025 16:58:53 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id B014EE008FA5; Mon, 1 Sep 2025 16:58:52 +0800 (CST) X-ns-mid: postfix-68B5604C-514101748 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 93864E008FA7; Mon, 1 Sep 2025 16:58:43 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 11/12] thermal/drivers/ti-soc-thermal: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:47 +0800 Message-Id: <20250901085748.36795-12-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/t= hermal/ti-soc-thermal/ti-thermal-common.c index 0cf0826b805a..daea718291a6 100644 --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c @@ -27,7 +27,6 @@ =20 /* common data structures */ struct ti_thermal_data { - struct cpufreq_policy *policy; struct thermal_zone_device *ti_thermal; struct thermal_zone_device *pcb_tz; struct thermal_cooling_device *cool_dev; @@ -218,6 +217,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *= bgp, int id) { struct ti_thermal_data *data; struct device_node *np =3D bgp->dev->of_node; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D cpufreq_cpu_= get(0); =20 /* * We are assuming here that if one deploys the zone @@ -234,8 +234,7 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *= bgp, int id) if (!data) return -EINVAL; =20 - data->policy =3D cpufreq_cpu_get(0); - if (!data->policy) { + if (!policy) { pr_debug("%s: CPUFreq policy not found\n", __func__); return -EPROBE_DEFER; } @@ -246,7 +245,6 @@ int ti_thermal_register_cpu_cooling(struct ti_bandgap *= bgp, int id) int ret =3D PTR_ERR(data->cool_dev); dev_err(bgp->dev, "Failed to register cpu cooling device %d\n", ret); - cpufreq_cpu_put(data->policy); =20 return ret; } @@ -261,11 +259,8 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandga= p *bgp, int id) =20 data =3D ti_bandgap_get_sensor_data(bgp, id); =20 - if (!IS_ERR_OR_NULL(data)) { + if (!IS_ERR_OR_NULL(data)) cpufreq_cooling_unregister(data->cool_dev); - if (data->policy) - cpufreq_cpu_put(data->policy); - } =20 return 0; } --=20 2.25.1 From nobody Fri Oct 3 12:13:07 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3C343002DC; Mon, 1 Sep 2025 08:59:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717153; cv=none; b=W7ACWeXGCjk1Vv+2xRpZCmUXteXTuf7xN8Tv/7eWJ8TgvdEG1BB3V3yJ0ZZqL5RRDce6YHrFc3IYqH1YvgQikZCD80RdjYd4Zd7ssh9Qoyes9JlzWZjfrWxndpOyY1d65Nvr9ApC654ZD00zp9oBBloH5XHxcdqJg4hjIZG8sSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756717153; c=relaxed/simple; bh=4tj3hkSdGBHU2nCv4WncFZkMvmh6Z1BDT7S6gxT4ks0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mxA8AlW/SpI8yYB8+UVet4rd3W+0C5s2wPRXRTApBHxvzkwqBq05I75nmyswhm4W3HkaBI0cJCZ5leczyB58Bu9OpopGJtbz4PRg8XF1iSxd07pPo18L8uXcj8IZ/xn9zlarj/QSlyygGCTlb4Os2YGyC6DO2qwFWkf0i0cLRR0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: e86bfae4871111f0b29709d653e92f7d-20250901 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:9856c3cb-6274-461f-bd60-bd9e3453544a,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:6493067,CLOUDID:1f38d007408be91faa64e7344a36a8e5,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV :0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: e86bfae4871111f0b29709d653e92f7d-20250901 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1266094301; Mon, 01 Sep 2025 16:59:03 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id B89CBE008FA7; Mon, 1 Sep 2025 16:59:02 +0800 (CST) X-ns-mid: postfix-68B56055-952872770 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id C0DDDE008FA8; Mon, 1 Sep 2025 16:58:52 +0800 (CST) From: Zihuan Zhang To: "Rafael J . wysocki" , Viresh Kumar , Catalin Marinas , Will Deacon , Borislav Petkov , Dave Hansen , Srinivas Pandruvada , Michael Ellerman , Krzysztof Kozlowski , Alim Akhtar , Thierry Reding , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Jani Nikula , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Daniel Lezcano , Sascha Hauer , Shawn Guo , Eduardo Valentin , Keerthy Cc: Ben Horgan , zhenglifeng , Zhang Rui , Len Brown , Lukasz Luba , Pengutronix Kernel Team , Beata Michalska , Fabio Estevam , Pavel Machek , Sumit Gupta , Prasanna Kumar T S M , Sudeep Holla , Yicong Yang , linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper Date: Mon, 1 Sep 2025 16:57:48 +0800 Message-Id: <20250901085748.36795-13-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250901085748.36795-1-zhangzihuan@kylinos.cn> References: <20250901085748.36795-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy) annotation for policy references. This reduces the risk of reference counting mistakes and aligns the code with the latest kernel style. No functional change intended. Signed-off-by: Zihuan Zhang --- kernel/power/energy_model.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index ea7995a25780..852d48039ce2 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -451,7 +451,7 @@ static void em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *t= able) { struct em_perf_domain *pd =3D dev->em_pd; - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy); int found =3D 0; int i, cpu; =20 @@ -479,8 +479,6 @@ em_cpufreq_update_efficiencies(struct device *dev, stru= ct em_perf_state *table) found++; } =20 - cpufreq_cpu_put(policy); - if (!found) return; =20 @@ -787,21 +785,20 @@ static void em_check_capacity_update(void) =20 /* Check if CPUs capacity has changed than update EM */ for_each_possible_cpu(cpu) { - struct cpufreq_policy *policy; + struct cpufreq_policy *policy __free(put_cpufreq_policy) =3D + cpufreq_cpu_get(cpu); struct em_perf_domain *pd; struct device *dev; =20 if (cpumask_test_cpu(cpu, cpu_done_mask)) continue; =20 - policy =3D cpufreq_cpu_get(cpu); if (!policy) { pr_debug("Accessing cpu%d policy failed\n", cpu); schedule_delayed_work(&em_update_work, msecs_to_jiffies(1000)); break; } - cpufreq_cpu_put(policy); =20 dev =3D get_cpu_device(cpu); pd =3D em_pd_get(dev); --=20 2.25.1