All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* kernel/power/energy_model.c:316 em_dev_register_perf_domain() error: we previously assumed 'dev->em_pd' could be null (see line 277)
@ 2021-06-12 19:10 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-12 19:10 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 7064 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Lukasz Luba <lukasz.luba@arm.com>
CC: "Rafael J. Wysocki" <rjw@rjwysocki.net>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ad347abe4a9876b1f65f408ab467137e88f77eb4
commit: 1bc138c622959979eb547be2d3bbc6442a5c80b0 PM / EM: add support for other devices than CPUs in Energy Model
date:   12 months ago
:::::: branch date: 19 hours ago
:::::: commit date: 12 months ago
config: x86_64-randconfig-m001-20210612 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
kernel/power/energy_model.c:316 em_dev_register_perf_domain() error: we previously assumed 'dev->em_pd' could be null (see line 277)

vim +316 kernel/power/energy_model.c

27871f7a8a341e Quentin Perret  2018-12-03  244  
27871f7a8a341e Quentin Perret  2018-12-03  245  /**
7d9895c7fbfc9c Lukasz Luba     2020-05-27  246   * em_dev_register_perf_domain() - Register the Energy Model (EM) for a device
7d9895c7fbfc9c Lukasz Luba     2020-05-27  247   * @dev		: Device for which the EM is to register
521b512b157a13 Lukasz Luba     2020-05-27  248   * @nr_states	: Number of performance states to register
27871f7a8a341e Quentin Perret  2018-12-03  249   * @cb		: Callback functions providing the data of the Energy Model
1bc138c6229599 Lukasz Luba     2020-06-10  250   * @cpus	: Pointer to cpumask_t, which in case of a CPU device is
7d9895c7fbfc9c Lukasz Luba     2020-05-27  251   *		obligatory. It can be taken from i.e. 'policy->cpus'. For other
7d9895c7fbfc9c Lukasz Luba     2020-05-27  252   *		type of devices this should be set to NULL.
27871f7a8a341e Quentin Perret  2018-12-03  253   *
27871f7a8a341e Quentin Perret  2018-12-03  254   * Create Energy Model tables for a performance domain using the callbacks
27871f7a8a341e Quentin Perret  2018-12-03  255   * defined in cb.
27871f7a8a341e Quentin Perret  2018-12-03  256   *
27871f7a8a341e Quentin Perret  2018-12-03  257   * If multiple clients register the same performance domain, all but the first
27871f7a8a341e Quentin Perret  2018-12-03  258   * registration will be ignored.
27871f7a8a341e Quentin Perret  2018-12-03  259   *
27871f7a8a341e Quentin Perret  2018-12-03  260   * Return 0 on success
27871f7a8a341e Quentin Perret  2018-12-03  261   */
7d9895c7fbfc9c Lukasz Luba     2020-05-27  262  int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
1bc138c6229599 Lukasz Luba     2020-06-10  263  				struct em_data_callback *cb, cpumask_t *cpus)
27871f7a8a341e Quentin Perret  2018-12-03  264  {
27871f7a8a341e Quentin Perret  2018-12-03  265  	unsigned long cap, prev_cap = 0;
1bc138c6229599 Lukasz Luba     2020-06-10  266  	int cpu, ret;
27871f7a8a341e Quentin Perret  2018-12-03  267  
1bc138c6229599 Lukasz Luba     2020-06-10  268  	if (!dev || !nr_states || !cb)
27871f7a8a341e Quentin Perret  2018-12-03  269  		return -EINVAL;
27871f7a8a341e Quentin Perret  2018-12-03  270  
27871f7a8a341e Quentin Perret  2018-12-03  271  	/*
27871f7a8a341e Quentin Perret  2018-12-03  272  	 * Use a mutex to serialize the registration of performance domains and
27871f7a8a341e Quentin Perret  2018-12-03  273  	 * let the driver-defined callback functions sleep.
27871f7a8a341e Quentin Perret  2018-12-03  274  	 */
27871f7a8a341e Quentin Perret  2018-12-03  275  	mutex_lock(&em_pd_mutex);
27871f7a8a341e Quentin Perret  2018-12-03  276  
1bc138c6229599 Lukasz Luba     2020-06-10 @277  	if (dev->em_pd) {
27871f7a8a341e Quentin Perret  2018-12-03  278  		ret = -EEXIST;
27871f7a8a341e Quentin Perret  2018-12-03  279  		goto unlock;
27871f7a8a341e Quentin Perret  2018-12-03  280  	}
27871f7a8a341e Quentin Perret  2018-12-03  281  
1bc138c6229599 Lukasz Luba     2020-06-10  282  	if (_is_cpu_device(dev)) {
1bc138c6229599 Lukasz Luba     2020-06-10  283  		if (!cpus) {
1bc138c6229599 Lukasz Luba     2020-06-10  284  			dev_err(dev, "EM: invalid CPU mask\n");
1bc138c6229599 Lukasz Luba     2020-06-10  285  			ret = -EINVAL;
1bc138c6229599 Lukasz Luba     2020-06-10  286  			goto unlock;
1bc138c6229599 Lukasz Luba     2020-06-10  287  		}
1bc138c6229599 Lukasz Luba     2020-06-10  288  
1bc138c6229599 Lukasz Luba     2020-06-10  289  		for_each_cpu(cpu, cpus) {
1bc138c6229599 Lukasz Luba     2020-06-10  290  			if (em_cpu_get(cpu)) {
1bc138c6229599 Lukasz Luba     2020-06-10  291  				dev_err(dev, "EM: exists for CPU%d\n", cpu);
1bc138c6229599 Lukasz Luba     2020-06-10  292  				ret = -EEXIST;
1bc138c6229599 Lukasz Luba     2020-06-10  293  				goto unlock;
1bc138c6229599 Lukasz Luba     2020-06-10  294  			}
27871f7a8a341e Quentin Perret  2018-12-03  295  			/*
1bc138c6229599 Lukasz Luba     2020-06-10  296  			 * All CPUs of a domain must have the same
1bc138c6229599 Lukasz Luba     2020-06-10  297  			 * micro-architecture since they all share the same
1bc138c6229599 Lukasz Luba     2020-06-10  298  			 * table.
27871f7a8a341e Quentin Perret  2018-12-03  299  			 */
8ec59c0f5f4966 Vincent Guittot 2019-06-17  300  			cap = arch_scale_cpu_capacity(cpu);
27871f7a8a341e Quentin Perret  2018-12-03  301  			if (prev_cap && prev_cap != cap) {
1bc138c6229599 Lukasz Luba     2020-06-10  302  				dev_err(dev, "EM: CPUs of %*pbl must have the same capacity\n",
1bc138c6229599 Lukasz Luba     2020-06-10  303  					cpumask_pr_args(cpus));
1bc138c6229599 Lukasz Luba     2020-06-10  304  
27871f7a8a341e Quentin Perret  2018-12-03  305  				ret = -EINVAL;
27871f7a8a341e Quentin Perret  2018-12-03  306  				goto unlock;
27871f7a8a341e Quentin Perret  2018-12-03  307  			}
27871f7a8a341e Quentin Perret  2018-12-03  308  			prev_cap = cap;
27871f7a8a341e Quentin Perret  2018-12-03  309  		}
1bc138c6229599 Lukasz Luba     2020-06-10  310  	}
27871f7a8a341e Quentin Perret  2018-12-03  311  
1bc138c6229599 Lukasz Luba     2020-06-10  312  	ret = em_create_pd(dev, nr_states, cb, cpus);
1bc138c6229599 Lukasz Luba     2020-06-10  313  	if (ret)
27871f7a8a341e Quentin Perret  2018-12-03  314  		goto unlock;
27871f7a8a341e Quentin Perret  2018-12-03  315  
1bc138c6229599 Lukasz Luba     2020-06-10 @316  	em_debug_create_pd(dev);
1bc138c6229599 Lukasz Luba     2020-06-10  317  	dev_info(dev, "EM: created perf domain\n");
27871f7a8a341e Quentin Perret  2018-12-03  318  
27871f7a8a341e Quentin Perret  2018-12-03  319  unlock:
27871f7a8a341e Quentin Perret  2018-12-03  320  	mutex_unlock(&em_pd_mutex);
27871f7a8a341e Quentin Perret  2018-12-03  321  	return ret;
27871f7a8a341e Quentin Perret  2018-12-03  322  }
7d9895c7fbfc9c Lukasz Luba     2020-05-27  323  EXPORT_SYMBOL_GPL(em_dev_register_perf_domain);
7d9895c7fbfc9c Lukasz Luba     2020-05-27  324  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38440 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-12 19:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-12 19:10 kernel/power/energy_model.c:316 em_dev_register_perf_domain() error: we previously assumed 'dev->em_pd' could be null (see line 277) kernel test robot

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.