All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper
Date: Tue, 2 Sep 2025 23:25:13 +0800	[thread overview]
Message-ID: <202509022308.CeaKUqJM-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20250901085748.36795-13-zhangzihuan@kylinos.cn>
References: <20250901085748.36795-13-zhangzihuan@kylinos.cn>
TO: Zihuan Zhang <zhangzihuan@kylinos.cn>
TO: "Rafael J . wysocki" <rafael@kernel.org>
TO: Viresh Kumar <viresh.kumar@linaro.org>
TO: Catalin Marinas <catalin.marinas@arm.com>
TO: Will Deacon <will@kernel.org>
TO: Borislav Petkov <bp@alien8.de>
TO: Dave Hansen <dave.hansen@linux.intel.com>
TO: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
TO: Michael Ellerman <mpe@ellerman.id.au>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Alim Akhtar <alim.akhtar@samsung.com>
TO: Thierry Reding <thierry.reding@gmail.com>
TO: MyungJoo Ham <myungjoo.ham@samsung.com>
TO: Kyungmin Park <kyungmin.park@samsung.com>
TO: Chanwoo Choi <cw00.choi@samsung.com>
TO: Jani Nikula <jani.nikula@linux.intel.com>
TO: Rodrigo Vivi <rodrigo.vivi@intel.com>
TO: Tvrtko Ursulin <tursulin@ursulin.net>
TO: David Airlie <airlied@gmail.com>
TO: Simona Vetter <simona@ffwll.ch>
TO: Daniel Lezcano <daniel.lezcano@kernel.org>
TO: Sascha Hauer <s.hauer@pengutronix.de>
TO: Shawn Guo <shawnguo@kernel.org>
TO: Eduardo Valentin <edubezval@gmail.com>
TO: Keerthy <j-keerthy@ti.com>
CC: Ben Horgan <ben.horgan@arm.com>
CC: zhenglifeng <zhenglifeng1@huawei.com>
CC: Zhang Rui <rui.zhang@intel.com>
CC: Len Brown <lenb@kernel.org>
CC: Lukasz Luba <lukasz.luba@arm.com>
CC: Pengutronix Kernel Team <kernel@pengutronix.de>

Hi Zihuan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on rafael-pm/bleeding-edge rafael-pm/thermal arm64/for-next/core linus/master v6.17-rc4 next-20250902]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Zihuan-Zhang/arm64-topology-Use-scope-based-cleanup-helper/20250901-170106
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250901085748.36795-13-zhangzihuan%40kylinos.cn
patch subject: [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper
:::::: branch date: 30 hours ago
:::::: commit date: 30 hours ago
config: powerpc64-randconfig-r071-20250902 (https://download.01.org/0day-ci/archive/20250902/202509022308.CeaKUqJM-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 2e122990391b2ba062e6308a12cfedf7206270ba)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202509022308.CeaKUqJM-lkp@intel.com/

smatch warnings:
kernel/power/energy_model.c:454 em_cpufreq_update_efficiencies() error: uninitialized symbol 'policy'.
kernel/power/energy_model.c:454 em_cpufreq_update_efficiencies() error: uninitialized symbol 'policy'.

vim +/policy +454 kernel/power/energy_model.c

1bc138c6229599 Lukasz Luba       2020-06-10  449  
e7b1cc9a7ea6d7 Lukasz Luba       2024-02-08  450  static void
e7b1cc9a7ea6d7 Lukasz Luba       2024-02-08  451  em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
e458716a92b57f Vincent Donnefort 2021-09-08  452  {
e458716a92b57f Vincent Donnefort 2021-09-08  453  	struct em_perf_domain *pd = dev->em_pd;
3a096464b04b72 Zihuan Zhang      2025-09-01 @454  	struct cpufreq_policy *policy __free(put_cpufreq_policy);
e458716a92b57f Vincent Donnefort 2021-09-08  455  	int found = 0;
99907d6054f2d3 Lukasz Luba       2024-02-08  456  	int i, cpu;
e458716a92b57f Vincent Donnefort 2021-09-08  457  
e7b1cc9a7ea6d7 Lukasz Luba       2024-02-08  458  	if (!_is_cpu_device(dev))
e458716a92b57f Vincent Donnefort 2021-09-08  459  		return;
e458716a92b57f Vincent Donnefort 2021-09-08  460  
99907d6054f2d3 Lukasz Luba       2024-02-08  461  	/* Try to get a CPU which is active and in this PD */
99907d6054f2d3 Lukasz Luba       2024-02-08  462  	cpu = cpumask_first_and(em_span_cpus(pd), cpu_active_mask);
99907d6054f2d3 Lukasz Luba       2024-02-08  463  	if (cpu >= nr_cpu_ids) {
99907d6054f2d3 Lukasz Luba       2024-02-08  464  		dev_warn(dev, "EM: No online CPU for CPUFreq policy\n");
99907d6054f2d3 Lukasz Luba       2024-02-08  465  		return;
99907d6054f2d3 Lukasz Luba       2024-02-08  466  	}
99907d6054f2d3 Lukasz Luba       2024-02-08  467  
99907d6054f2d3 Lukasz Luba       2024-02-08  468  	policy = cpufreq_cpu_get(cpu);
e458716a92b57f Vincent Donnefort 2021-09-08  469  	if (!policy) {
4274521fabee05 Lukasz Luba       2024-02-08  470  		dev_warn(dev, "EM: Access to CPUFreq policy failed\n");
e458716a92b57f Vincent Donnefort 2021-09-08  471  		return;
e458716a92b57f Vincent Donnefort 2021-09-08  472  	}
e458716a92b57f Vincent Donnefort 2021-09-08  473  
e458716a92b57f Vincent Donnefort 2021-09-08  474  	for (i = 0; i < pd->nr_perf_states; i++) {
e458716a92b57f Vincent Donnefort 2021-09-08  475  		if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
e458716a92b57f Vincent Donnefort 2021-09-08  476  			continue;
e458716a92b57f Vincent Donnefort 2021-09-08  477  
e458716a92b57f Vincent Donnefort 2021-09-08  478  		if (!cpufreq_table_set_inefficient(policy, table[i].frequency))
e458716a92b57f Vincent Donnefort 2021-09-08  479  			found++;
e458716a92b57f Vincent Donnefort 2021-09-08  480  	}
e458716a92b57f Vincent Donnefort 2021-09-08  481  
e458716a92b57f Vincent Donnefort 2021-09-08  482  	if (!found)
e458716a92b57f Vincent Donnefort 2021-09-08  483  		return;
e458716a92b57f Vincent Donnefort 2021-09-08  484  
e458716a92b57f Vincent Donnefort 2021-09-08  485  	/*
e458716a92b57f Vincent Donnefort 2021-09-08  486  	 * Efficiencies have been installed in CPUFreq, inefficient frequencies
e458716a92b57f Vincent Donnefort 2021-09-08  487  	 * will be skipped. The EM can do the same.
e458716a92b57f Vincent Donnefort 2021-09-08  488  	 */
e458716a92b57f Vincent Donnefort 2021-09-08  489  	pd->flags |= EM_PERF_DOMAIN_SKIP_INEFFICIENCIES;
e458716a92b57f Vincent Donnefort 2021-09-08  490  }
e458716a92b57f Vincent Donnefort 2021-09-08  491  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Zihuan Zhang <zhangzihuan@kylinos.cn>,
	"Rafael J . wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>,
	Eduardo Valentin <edubezval@gmail.com>,
	Keerthy <j-keerthy@ti.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Ben Horgan <ben.horgan@arm.com>,
	zhenglifeng <zhenglifeng1@huawei.com>,
	Zhang Rui <rui.zhang@intel.com>, Len Brown <lenb@kernel.org>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Pengutronix Kernel Team <kernel@pengutronix.de>
Subject: Re: [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper
Date: Tue, 2 Sep 2025 18:53:20 +0300	[thread overview]
Message-ID: <202509022308.CeaKUqJM-lkp@intel.com> (raw)
Message-ID: <20250902155320.eHCRIogVYa6nQ8mwc5xWqwNKsNB2oJtMrH3ychlP3hY@z> (raw)
In-Reply-To: <20250901085748.36795-13-zhangzihuan@kylinos.cn>

Hi Zihuan,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Zihuan-Zhang/arm64-topology-Use-scope-based-cleanup-helper/20250901-170106
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20250901085748.36795-13-zhangzihuan%40kylinos.cn
patch subject: [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper
config: powerpc64-randconfig-r071-20250902 (https://download.01.org/0day-ci/archive/20250902/202509022308.CeaKUqJM-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 2e122990391b2ba062e6308a12cfedf7206270ba)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202509022308.CeaKUqJM-lkp@intel.com/

smatch warnings:
kernel/power/energy_model.c:454 em_cpufreq_update_efficiencies() error: uninitialized symbol 'policy'.

vim +/policy +454 kernel/power/energy_model.c

e7b1cc9a7ea6d7 Lukasz Luba       2024-02-08  450  static void
e7b1cc9a7ea6d7 Lukasz Luba       2024-02-08  451  em_cpufreq_update_efficiencies(struct device *dev, struct em_perf_state *table)
e458716a92b57f Vincent Donnefort 2021-09-08  452  {
e458716a92b57f Vincent Donnefort 2021-09-08  453  	struct em_perf_domain *pd = dev->em_pd;
3a096464b04b72 Zihuan Zhang      2025-09-01 @454  	struct cpufreq_policy *policy __free(put_cpufreq_policy);

policy needs to be set to NULL here.

e458716a92b57f Vincent Donnefort 2021-09-08  455  	int found = 0;
99907d6054f2d3 Lukasz Luba       2024-02-08  456  	int i, cpu;
e458716a92b57f Vincent Donnefort 2021-09-08  457  
e7b1cc9a7ea6d7 Lukasz Luba       2024-02-08  458  	if (!_is_cpu_device(dev))
e458716a92b57f Vincent Donnefort 2021-09-08  459  		return;
                                                                ^^^^^^
returning before an initialization is an uninitialized variable bug.

e458716a92b57f Vincent Donnefort 2021-09-08  460  
99907d6054f2d3 Lukasz Luba       2024-02-08  461  	/* Try to get a CPU which is active and in this PD */
99907d6054f2d3 Lukasz Luba       2024-02-08  462  	cpu = cpumask_first_and(em_span_cpus(pd), cpu_active_mask);
99907d6054f2d3 Lukasz Luba       2024-02-08  463  	if (cpu >= nr_cpu_ids) {
99907d6054f2d3 Lukasz Luba       2024-02-08  464  		dev_warn(dev, "EM: No online CPU for CPUFreq policy\n");
99907d6054f2d3 Lukasz Luba       2024-02-08  465  		return;
99907d6054f2d3 Lukasz Luba       2024-02-08  466  	}
99907d6054f2d3 Lukasz Luba       2024-02-08  467  
99907d6054f2d3 Lukasz Luba       2024-02-08  468  	policy = cpufreq_cpu_get(cpu);

Or we could declare it here:

	struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);

e458716a92b57f Vincent Donnefort 2021-09-08  469  	if (!policy) {
4274521fabee05 Lukasz Luba       2024-02-08  470  		dev_warn(dev, "EM: Access to CPUFreq policy failed\n");
e458716a92b57f Vincent Donnefort 2021-09-08  471  		return;
e458716a92b57f Vincent Donnefort 2021-09-08  472  	}
e458716a92b57f Vincent Donnefort 2021-09-08  473  
e458716a92b57f Vincent Donnefort 2021-09-08  474  	for (i = 0; i < pd->nr_perf_states; i++) {
e458716a92b57f Vincent Donnefort 2021-09-08  475  		if (!(table[i].flags & EM_PERF_STATE_INEFFICIENT))
e458716a92b57f Vincent Donnefort 2021-09-08  476  			continue;
e458716a92b57f Vincent Donnefort 2021-09-08  477  
e458716a92b57f Vincent Donnefort 2021-09-08  478  		if (!cpufreq_table_set_inefficient(policy, table[i].frequency))
e458716a92b57f Vincent Donnefort 2021-09-08  479  			found++;
e458716a92b57f Vincent Donnefort 2021-09-08  480  	}
e458716a92b57f Vincent Donnefort 2021-09-08  481  
e458716a92b57f Vincent Donnefort 2021-09-08  482  	if (!found)
e458716a92b57f Vincent Donnefort 2021-09-08  483  		return;
e458716a92b57f Vincent Donnefort 2021-09-08  484  
e458716a92b57f Vincent Donnefort 2021-09-08  485  	/*
e458716a92b57f Vincent Donnefort 2021-09-08  486  	 * Efficiencies have been installed in CPUFreq, inefficient frequencies
e458716a92b57f Vincent Donnefort 2021-09-08  487  	 * will be skipped. The EM can do the same.
e458716a92b57f Vincent Donnefort 2021-09-08  488  	 */
e458716a92b57f Vincent Donnefort 2021-09-08  489  	pd->flags |= EM_PERF_DOMAIN_SKIP_INEFFICIENCIES;
e458716a92b57f Vincent Donnefort 2021-09-08  490  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


             reply	other threads:[~2025-09-02 15:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 15:25 kernel test robot [this message]
2025-09-02 15:53 ` [PATCH v3 12/12] PM: EM: Use scope-based cleanup helper Dan Carpenter
2025-09-03  2:30 ` Zihuan Zhang
  -- strict thread matches above, loose matches on Subject: below --
2025-09-01  8:57 [PATCH v3 00/12] cpufreq: use __free() for all cpufreq_cpu_get() references Zihuan Zhang
2025-09-01  8:57 ` [PATCH v3 01/12] arm64: topology: Use scope-based cleanup helper Zihuan Zhang
2025-09-02  5:26   ` kernel test robot
2025-09-01  8:57 ` [PATCH v3 02/12] ACPI: processor: thermal: " Zihuan Zhang
2025-09-03 11:07   ` Rafael J. Wysocki
2025-09-01  8:57 ` [PATCH v3 03/12] cpufreq: intel_pstate: " Zihuan Zhang
2025-09-01 15:17   ` Rafael J. Wysocki
2025-09-02 10:32     ` Zihuan Zhang
2025-09-02 11:47       ` Rafael J. Wysocki
2025-09-03  0:51         ` Zihuan Zhang
2025-09-03 11:04           ` Rafael J. Wysocki
2025-09-01  8:57 ` [PATCH v3 04/12] cpufreq: longhaul: " Zihuan Zhang
2025-09-02 15:58   ` Krzysztof Kozlowski
2025-09-01  8:57 ` [PATCH v3 05/12] cpufreq: powernv: " Zihuan Zhang
2025-09-01  8:57 ` [PATCH v3 06/12] PM / devfreq: " Zihuan Zhang
2025-09-01  8:57 ` [PATCH v3 07/12] drm/i915: " Zihuan Zhang
2025-09-01  8:57 ` [PATCH v3 08/12] cpufreq: powerpc: macintosh: " Zihuan Zhang
2025-09-02 15:59   ` Krzysztof Kozlowski
2025-09-01  8:57 ` [PATCH v3 09/12] powercap: dtpm_cpu: " Zihuan Zhang
2025-09-03 11:43   ` Rafael J. Wysocki
2025-09-01  8:57 ` [PATCH v3 10/12] thermal: imx: " Zihuan Zhang
2025-09-02  6:30   ` kernel test robot
2025-09-01  8:57 ` [PATCH v3 11/12] thermal/drivers/ti-soc-thermal: " Zihuan Zhang
2025-09-02  6:19   ` kernel test robot
2025-09-01  8:57 ` [PATCH v3 12/12] PM: EM: " Zihuan Zhang
2025-09-02 15:57   ` Krzysztof Kozlowski
2025-09-03  2:12     ` Zihuan Zhang
2025-09-03  6:11       ` Krzysztof Kozlowski
2025-09-02 16:44 ` ✓ i915.CI.BAT: success for cpufreq: use __free() for all cpufreq_cpu_get() references (rev3) Patchwork
2025-09-03  0:41 ` ✗ i915.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202509022308.CeaKUqJM-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.