[chanwoo:devfreq-testing 4/4] drivers/devfreq/governor_passive.c:350:3: warning: this 'if' clause does not guard...
From: kernel test robot
Date: Thu Jul 15 2021 - 07:00:48 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git devfreq-testing
head: 52c939f2c35e2e9108daef8da5dda2c9eca80532
commit: 52c939f2c35e2e9108daef8da5dda2c9eca80532 [4/4] PM / devfreq: passive: Update frequency when start governor
config: m68k-buildonly-randconfig-r006-20210714 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.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/chanwoo/linux.git/commit/?id=52c939f2c35e2e9108daef8da5dda2c9eca80532
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 52c939f2c35e2e9108daef8da5dda2c9eca80532
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
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 'devfreq_passive_event_handler':
>> drivers/devfreq/governor_passive.c:350:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
350 | if (parent->previous_freq)
| ^~
drivers/devfreq/governor_passive.c:352:4: 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);
| ^~~
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