public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [djbw:devsec-20240829 5/6] drivers/pci/tsm.c:215:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false
@ 2024-09-02 10:04 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-09-02 10:04 UTC (permalink / raw)
  To: Dan Williams; +Cc: llvm, oe-kbuild-all, Xu Yilun

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djbw/linux.git devsec-20240829
head:   c412ecb5794c43513093a92b3730389cfd76e17f
commit: 5807465b92acdf29166415fcf35db30572ffa44b [5/6] PCI/TSM: Authenticate devices via platform TSM
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240902/202409021701.f3Xpx5wU-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240902/202409021701.f3Xpx5wU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409021701.f3Xpx5wU-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/pci/tsm.c:215:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     215 |         if (tsm_ops)
         |             ^~~~~~~
   drivers/pci/tsm.c:219:19: note: uninitialized use occurs here
     219 |         for_each_pci_dev(pdev)
         |                          ^~~~
   include/linux/pci.h:550:80: note: expanded from macro 'for_each_pci_dev'
     550 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
         |                                                                                ^
   drivers/pci/tsm.c:215:2: note: remove the 'if' if its condition is always true
     215 |         if (tsm_ops)
         |         ^~~~~~~~~~~~
     216 |                 return -EBUSY;
   drivers/pci/tsm.c:210:22: note: initialize the variable 'pdev' to silence this warning
     210 |         struct pci_dev *pdev;
         |                             ^
         |                              = NULL
   drivers/pci/tsm.c:250:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     250 |         if (ops != tsm_ops)
         |             ^~~~~~~~~~~~~~
   drivers/pci/tsm.c:252:19: note: uninitialized use occurs here
     252 |         for_each_pci_dev(pdev)
         |                          ^~~~
   include/linux/pci.h:550:80: note: expanded from macro 'for_each_pci_dev'
     550 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
         |                                                                                ^
   drivers/pci/tsm.c:250:2: note: remove the 'if' if its condition is always true
     250 |         if (ops != tsm_ops)
         |         ^~~~~~~~~~~~~~~~~~~
     251 |                 return;
   drivers/pci/tsm.c:245:22: note: initialize the variable 'pdev' to silence this warning
     245 |         struct pci_dev *pdev;
         |                             ^
         |                              = NULL
   2 warnings generated.


vim +215 drivers/pci/tsm.c

   207	
   208	int pci_tsm_register(const struct pci_tsm_ops *ops, const struct attribute_group *grp)
   209	{
   210		struct pci_dev *pdev;
   211	
   212		if (!ops)
   213			return 0;
   214		guard(rwsem_write)(&pci_tsm_rwsem);
 > 215		if (tsm_ops)
   216			return -EBUSY;
   217		tsm_ops = ops;
   218		pci_tsm_owner_attr_group = grp;
   219		for_each_pci_dev(pdev)
   220			__pci_tsm_init(pdev);
   221		return 0;
   222	}
   223	EXPORT_SYMBOL_GPL(pci_tsm_register);
   224	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

only message in thread, other threads:[~2024-09-02 10:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 10:04 [djbw:devsec-20240829 5/6] drivers/pci/tsm.c:215:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false kernel test robot

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