tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
pending-5.13
head: 0c91fa6be7e9e93e0ff59925e742ebb9d86fb057
commit: b8fe99c7a5fa0b89e7dba24344c839d2e5f938f4 [462/570] cpufreq: CPPC: Fix potential
memleak in cppc_cpufreq_cpu_init
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-linux-stable
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-linux-stable pending-5.13
git checkout b8fe99c7a5fa0b89e7dba24344c839d2e5f938f4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/cpufreq/cppc_cpufreq.c: In function 'cppc_cpufreq_stop_cpu':
> drivers/cpufreq/cppc_cpufreq.c:199:2: error: implicit declaration
of function 'cppc_cpufreq_put_cpu_data'; did you mean
'cppc_cpufreq_stop_cpu'? [-Werror=implicit-function-declaration]
199 |
cppc_cpufreq_put_cpu_data(policy);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
| cppc_cpufreq_stop_cpu
drivers/cpufreq/cppc_cpufreq.c: At top level:
drivers/cpufreq/cppc_cpufreq.c:276:13: warning: conflicting types for
'cppc_cpufreq_put_cpu_data'
276 | static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/cpufreq/cppc_cpufreq.c:276:13: error: static declaration
of 'cppc_cpufreq_put_cpu_data' follows non-static declaration
drivers/cpufreq/cppc_cpufreq.c:199:2: note: previous implicit declaration of
'cppc_cpufreq_put_cpu_data' was here
199 | cppc_cpufreq_put_cpu_data(policy);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +199 drivers/cpufreq/cppc_cpufreq.c
184
185 static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy)
186 {
187 struct cppc_cpudata *cpu_data = policy->driver_data;
188 struct cppc_perf_caps *caps = &cpu_data->perf_caps;
189 unsigned int cpu = policy->cpu;
190 int ret;
191
192 cpu_data->perf_ctrls.desired_perf = caps->lowest_perf;
193
194 ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls);
195 if (ret)
196 pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n",
197 caps->lowest_perf, cpu, ret);
198
199 cppc_cpufreq_put_cpu_data(policy);
200 }
201
202 /*
203 * The PCC subspace describes the rate at which platform can accept commands
204 * on the shared PCC channel (including READs which do not count towards freq
205 * transition requests), so ideally we need to use the PCC values as a fallback
206 * if we don't have a platform specific transition_delay_us
207 */
208 #ifdef CONFIG_ARM64
209 #include <asm/cputype.h>
210
211 static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
212 {
213 unsigned long implementor = read_cpuid_implementor();
214 unsigned long part_num = read_cpuid_part_number();
215
216 switch (implementor) {
217 case ARM_CPU_IMP_QCOM:
218 switch (part_num) {
219 case QCOM_CPU_PART_FALKOR_V1:
220 case QCOM_CPU_PART_FALKOR:
221 return 10000;
222 }
223 }
224 return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
225 }
226
227 #else
228
229 static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
230 {
231 return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
232 }
233 #endif
234
235
236 static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu)
237 {
238 struct cppc_cpudata *cpu_data;
239 int ret;
240
241 cpu_data = kzalloc(sizeof(struct cppc_cpudata), GFP_KERNEL);
242 if (!cpu_data)
243 goto out;
244
245 if (!zalloc_cpumask_var(&cpu_data->shared_cpu_map, GFP_KERNEL))
246 goto free_cpu;
247
248 ret = acpi_get_psd_map(cpu, cpu_data);
249 if (ret) {
250 pr_debug("Err parsing CPU%d PSD data: ret:%d\n", cpu, ret);
251 goto free_mask;
252 }
253
254 ret = cppc_get_perf_caps(cpu, &cpu_data->perf_caps);
255 if (ret) {
256 pr_debug("Err reading CPU%d perf caps: ret:%d\n", cpu, ret);
257 goto free_mask;
258 }
259
260 /* Convert the lowest and nominal freq from MHz to KHz */
261 cpu_data->perf_caps.lowest_freq *= 1000;
262 cpu_data->perf_caps.nominal_freq *= 1000;
263
264 list_add(&cpu_data->node, &cpu_data_list);
265
266 return cpu_data;
267
268 free_mask:
269 free_cpumask_var(cpu_data->shared_cpu_map);
270 free_cpu:
271 kfree(cpu_data);
272 out:
273 return NULL;
274 }
275
276 static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy
*policy)
277 {
278 struct cppc_cpudata *cpu_data = policy->driver_data;
279
280 list_del(&cpu_data->node);
281 free_cpumask_var(cpu_data->shared_cpu_map);
282 kfree(cpu_data);
283 policy->driver_data = NULL;
284 }
285
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org