Re: [RESEND PATCH v2 1/2] PM / domains: Introduce multi PM domains helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Daniel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on shawnguo/for-next linux/master linus/master v5.8-rc2 next-20200623]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Daniel-Baluta/Introduce-multi-PM-domains-helpers/20200623-193706
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-s001-20200623 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=i386 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> drivers/base/power/common.c:260:33: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned int [usertype] size @@     got restricted gfp_t @@
>> drivers/base/power/common.c:260:33: sparse:     expected unsigned int [usertype] size
>> drivers/base/power/common.c:260:33: sparse:     got restricted gfp_t
>> drivers/base/power/common.c:260:45: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected restricted gfp_t [usertype] gfp @@     got unsigned int @@
>> drivers/base/power/common.c:260:45: sparse:     expected restricted gfp_t [usertype] gfp
>> drivers/base/power/common.c:260:45: sparse:     got unsigned int

vim +260 drivers/base/power/common.c

   231	
   232	/**
   233	 * dev_multi_pm_attach - power up device associated power domains
   234	 * @dev: The device used to lookup the PM domains
   235	 *
   236	 * Parse device's OF node to find all PM domains specifiers. For each power
   237	 * domain found, create a virtual device and associate it with the
   238	 * current power domain.
   239	 *
   240	 * This function should typically be invoked by a driver during the
   241	 * probe phase, in the case its device requires power management through
   242	 * multiple PM domains.
   243	 *
   244	 * Returns a pointer to @dev_multi_pm_domain_data if successfully attached PM
   245	 * domains, NULL when the device doesn't need a PM domain or when single
   246	 * power-domains exists for it, else an ERR_PTR() in case of
   247	 * failures.
   248	 */
   249	struct dev_multi_pm_domain_data *dev_multi_pm_attach(struct device *dev)
   250	{
   251		struct dev_multi_pm_domain_data *mpd, *retp;
   252		int num_domains;
   253		int i;
   254	
   255		num_domains = of_count_phandle_with_args(dev->of_node, "power-domains",
   256							 "#power-domain-cells");
   257		if (num_domains < 2)
   258			return NULL;
   259	
 > 260		mpd = devm_kzalloc(dev, GFP_KERNEL, sizeof(*mpd));
   261		if (!mpd)
   262			return ERR_PTR(-ENOMEM);
   263	
   264		mpd->dev = dev;
   265		mpd->num_domains = num_domains;
   266	
   267		mpd->virt_devs = devm_kmalloc_array(dev, mpd->num_domains,
   268						    sizeof(*mpd->virt_devs),
   269						    GFP_KERNEL);
   270		if (!mpd->virt_devs)
   271			return ERR_PTR(-ENOMEM);
   272	
   273		mpd->links = devm_kmalloc_array(dev, mpd->num_domains,
   274						sizeof(*mpd->links), GFP_KERNEL);
   275		if (!mpd->links)
   276			return ERR_PTR(-ENOMEM);
   277	
   278		for (i = 0; i < mpd->num_domains; i++) {
   279			mpd->virt_devs[i] = dev_pm_domain_attach_by_id(dev, i);
   280			if (IS_ERR(mpd->virt_devs[i])) {
   281				retp = (struct dev_multi_pm_domain_data *)
   282					mpd->virt_devs[i];
   283				goto exit_unroll_pm;
   284			}
   285			mpd->links[i] = device_link_add(dev, mpd->virt_devs[i],
   286							DL_FLAG_STATELESS |
   287							DL_FLAG_PM_RUNTIME |
   288							DL_FLAG_RPM_ACTIVE);
   289			if (!mpd->links[i]) {
   290				retp = ERR_PTR(-ENOMEM);
   291				dev_pm_domain_detach(mpd->virt_devs[i], false);
   292				goto exit_unroll_pm;
   293			}
   294		}
   295		return mpd;
   296	
   297	exit_unroll_pm:
   298		while (--i >= 0) {
   299			device_link_del(mpd->links[i]);
   300			dev_pm_domain_detach(mpd->virt_devs[i], false);
   301		}
   302	
   303		return retp;
   304	}
   305	EXPORT_SYMBOL(dev_multi_pm_attach);
   306	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux