GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
* [ammarfaizi2-block:tglx/devel/devmsi 46/86] kernel/irq/msi.c:399 msi_domain_get_virq() warn: inconsistent returns '&dev->msi.data->mutex'.
@ 2022-11-07 12:39 Dan Carpenter
  2022-11-12 17:41 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-11-07 12:39 UTC (permalink / raw)
  To: oe-kbuild, Ahmed S. Darwish
  Cc: lkp, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List, Thomas Gleixner

tree:   https://github.com/ammarfaizi2/linux-block tglx/devel/devmsi
head:   ba77f809fa66b636222f6677ec7cf8faa1562fe7
commit: 022573e1aaf0745ab002f898c5d4aa0f0ae5ec09 [46/86] genirq/msi: Make msi_get_virq() device domain aware
config: openrisc-randconfig-m031-20221106
compiler: or1k-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
kernel/irq/msi.c:399 msi_domain_get_virq() warn: inconsistent returns '&dev->msi.data->mutex'.

vim +399 kernel/irq/msi.c

022573e1aaf074 Ahmed S. Darwish 2022-11-03  361  unsigned int msi_domain_get_virq(struct device *dev, unsigned int domid, unsigned int index)
cf15f43acaad31 Thomas Gleixner  2021-12-10  362  {
cf15f43acaad31 Thomas Gleixner  2021-12-10  363  	struct msi_desc *desc;
495c66aca3da70 Thomas Gleixner  2021-12-06  364  	unsigned int ret = 0;
022573e1aaf074 Ahmed S. Darwish 2022-11-03  365  	bool pcimsi = false;
022573e1aaf074 Ahmed S. Darwish 2022-11-03  366  	int base;
cf15f43acaad31 Thomas Gleixner  2021-12-10  367  
cf15f43acaad31 Thomas Gleixner  2021-12-10  368  	if (!dev->msi.data)
cf15f43acaad31 Thomas Gleixner  2021-12-10  369  		return 0;
cf15f43acaad31 Thomas Gleixner  2021-12-10  370  
022573e1aaf074 Ahmed S. Darwish 2022-11-03  371  	if (WARN_ON_ONCE(index >= MSI_MAX_INDEX))
022573e1aaf074 Ahmed S. Darwish 2022-11-03  372  		return 0;
022573e1aaf074 Ahmed S. Darwish 2022-11-03  373  
022573e1aaf074 Ahmed S. Darwish 2022-11-03  374  	/* This check is only valid for the PCI default MSI domain */
022573e1aaf074 Ahmed S. Darwish 2022-11-03  375  	if (dev_is_pci(dev) && domid == MSI_DEFAULT_DOMAIN)
022573e1aaf074 Ahmed S. Darwish 2022-11-03  376  		pcimsi = to_pci_dev(dev)->msi_enabled;
cf15f43acaad31 Thomas Gleixner  2021-12-10  377  
495c66aca3da70 Thomas Gleixner  2021-12-06  378  	msi_lock_descs(dev);
022573e1aaf074 Ahmed S. Darwish 2022-11-03  379  
022573e1aaf074 Ahmed S. Darwish 2022-11-03  380  	base = msi_get_domain_base_index(dev, domid);
022573e1aaf074 Ahmed S. Darwish 2022-11-03  381  	if (base < 0)
022573e1aaf074 Ahmed S. Darwish 2022-11-03  382  		return 0;

msi_unlock_descs();?

022573e1aaf074 Ahmed S. Darwish 2022-11-03  383  
022573e1aaf074 Ahmed S. Darwish 2022-11-03  384  	desc = xa_load(&dev->msi.data->__store, base + pcimsi ? 0 : index);
cd6cf06590b979 Thomas Gleixner  2021-12-06  385  	if (desc && desc->irq) {
cf15f43acaad31 Thomas Gleixner  2021-12-10  386  		/*
cd6cf06590b979 Thomas Gleixner  2021-12-06  387  		 * PCI-MSI has only one descriptor for multiple interrupts.
cf15f43acaad31 Thomas Gleixner  2021-12-10  388  		 * PCI-MSIX and platform MSI use a descriptor per
cf15f43acaad31 Thomas Gleixner  2021-12-10  389  		 * interrupt.
cf15f43acaad31 Thomas Gleixner  2021-12-10  390  		 */
cd6cf06590b979 Thomas Gleixner  2021-12-06  391  		if (pcimsi) {
cd6cf06590b979 Thomas Gleixner  2021-12-06  392  			if (index < desc->nvec_used)
cd6cf06590b979 Thomas Gleixner  2021-12-06  393  				ret = desc->irq + index;
cd6cf06590b979 Thomas Gleixner  2021-12-06  394  		} else {
495c66aca3da70 Thomas Gleixner  2021-12-06  395  			ret = desc->irq;
cf15f43acaad31 Thomas Gleixner  2021-12-10  396  		}
495c66aca3da70 Thomas Gleixner  2021-12-06  397  	}
495c66aca3da70 Thomas Gleixner  2021-12-06  398  	msi_unlock_descs(dev);
495c66aca3da70 Thomas Gleixner  2021-12-06 @399  	return ret;
cf15f43acaad31 Thomas Gleixner  2021-12-10  400  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ammarfaizi2-block:tglx/devel/devmsi 46/86] kernel/irq/msi.c:399 msi_domain_get_virq() warn: inconsistent returns '&dev->msi.data->mutex'.
  2022-11-07 12:39 [ammarfaizi2-block:tglx/devel/devmsi 46/86] kernel/irq/msi.c:399 msi_domain_get_virq() warn: inconsistent returns '&dev->msi.data->mutex' Dan Carpenter
@ 2022-11-12 17:41 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2022-11-12 17:41 UTC (permalink / raw)
  To: Dan Carpenter, oe-kbuild, Ahmed S. Darwish
  Cc: lkp, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List

On Mon, Nov 07 2022 at 15:39, Dan Carpenter wrote:
> smatch warnings:
> kernel/irq/msi.c:399 msi_domain_get_virq() warn: inconsistent returns '&dev->msi.data->mutex'.
>
> vim +399 kernel/irq/msi.c
>
> 495c66aca3da70 Thomas Gleixner  2021-12-06  378  	msi_lock_descs(dev);
> 022573e1aaf074 Ahmed S. Darwish 2022-11-03  379  
> 022573e1aaf074 Ahmed S. Darwish 2022-11-03  380  	base = msi_get_domain_base_index(dev, domid);
> 022573e1aaf074 Ahmed S. Darwish 2022-11-03  381  	if (base < 0)
> 022573e1aaf074 Ahmed S. Darwish 2022-11-03  382  		return 0;
>
> msi_unlock_descs();?

Indeed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-12 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 12:39 [ammarfaizi2-block:tglx/devel/devmsi 46/86] kernel/irq/msi.c:399 msi_domain_get_virq() warn: inconsistent returns '&dev->msi.data->mutex' Dan Carpenter
2022-11-12 17:41 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox