[chanwoo:devfreq-testing 4/4] drivers/devfreq/governor_passive.c:350:17: warning: this 'if' clause does not guard...

From: kernel test robot
Date: Wed Sep 15 2021 - 10:35:39 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git devfreq-testing
head: c27162469a5f04fd237debefc710d28956b9704e
commit: c27162469a5f04fd237debefc710d28956b9704e [4/4] PM / devfreq: passive: Update frequency when start governor
config: nds32-randconfig-r002-20210915 (attached as .config)
compiler: nds32le-linux-gcc (GCC) 11.2.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/chanwoo/linux.git/commit/?id=c27162469a5f04fd237debefc710d28956b9704e
git remote add chanwoo https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
git fetch --no-tags chanwoo devfreq-testing
git checkout c27162469a5f04fd237debefc710d28956b9704e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=nds32

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/devfreq/governor_passive.c: In function 'cpufreq_passive_register_notifier':
drivers/devfreq/governor_passive.c:205:9: error: implicit declaration of function 'get_online_cpus'; did you mean 'get_online_mems'? [-Werror=implicit-function-declaration]
205 | get_online_cpus();
| ^~~~~~~~~~~~~~~
| get_online_mems
drivers/devfreq/governor_passive.c:255:9: error: implicit declaration of function 'put_online_cpus'; did you mean 'num_online_cpus'? [-Werror=implicit-function-declaration]
255 | put_online_cpus();
| ^~~~~~~~~~~~~~~
| num_online_cpus
drivers/devfreq/governor_passive.c: In function 'devfreq_passive_event_handler':
>> drivers/devfreq/governor_passive.c:350:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
350 | if (parent->previous_freq)
| ^~
drivers/devfreq/governor_passive.c:352:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
352 | ret = devfreq_update_target(devfreq, parent->previous_freq);
| ^~~
cc1: some warnings being treated as errors


vim +/if +350 drivers/devfreq/governor_passive.c

322
323 static int devfreq_passive_event_handler(struct devfreq *devfreq,
324 unsigned int event, void *data)
325 {
326 struct devfreq_passive_data *p_data
327 = (struct devfreq_passive_data *)devfreq->data;
328 struct devfreq *parent = (struct devfreq *)p_data->parent;
329 struct notifier_block *nb = &p_data->nb;
330 int ret = 0;
331
332 if (p_data->parent_type == DEVFREQ_PARENT_DEV && !parent)
333 return -EPROBE_DEFER;
334
335 switch (event) {
336 case DEVFREQ_GOV_START:
337 if (!p_data->this)
338 p_data->this = devfreq;
339
340 /*
341 * If the parent device changes the their frequency before
342 * registering the passive device, the passive device cannot
343 * receive the notification from parent device and then the
344 * passive device cannot be able to set the proper frequency
345 * according to the frequency of parent device.
346 *
347 * When start the passive governor, update the frequency
348 * according to the frequency of parent device.
349 */
> 350 if (parent->previous_freq)
351 mutex_lock(&devfreq->lock);
352 ret = devfreq_update_target(devfreq, parent->previous_freq);
353 if (ret < 0) {
354 dev_warn(&devfreq->dev,
355 "failed to update devfreq using passive governor\n");
356 mutex_unlock(&devfreq->lock);
357 }
358
359 if (p_data->parent_type == DEVFREQ_PARENT_DEV) {
360 nb->notifier_call = devfreq_passive_notifier_call;
361 ret = devfreq_register_notifier(parent, nb,
362 DEVFREQ_TRANSITION_NOTIFIER);
363 } else if (p_data->parent_type == CPUFREQ_PARENT_DEV) {
364 ret = cpufreq_passive_register_notifier(devfreq);
365 } else {
366 ret = -EINVAL;
367 }
368 break;
369 case DEVFREQ_GOV_STOP:
370 if (p_data->parent_type == DEVFREQ_PARENT_DEV)
371 WARN_ON(devfreq_unregister_notifier(parent, nb,
372 DEVFREQ_TRANSITION_NOTIFIER));
373 else if (p_data->parent_type == CPUFREQ_PARENT_DEV)
374 WARN_ON(cpufreq_passive_unregister_notifier(devfreq));
375 else
376 ret = -EINVAL;
377 break;
378 default:
379 break;
380 }
381
382 return ret;
383 }
384

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip