Re: [PATCH 2/2] net: mana: Allow MANA driver to allocate PCI vector dynamically

kernel test robot
2025-05-07T16:29:22Z

Hi Shradha,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus linus/master v6.15-rc5 next-20250507]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Shradha-Gupta/PCI-hv-enable-pci_hyperv-to-allow-dynamic-vector-allocation/20250416-233828
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/1744817781-3243-1-git-send-email-shradhagupta%40linux.microsoft.com
patch subject: [PATCH 2/2] net: mana: Allow MANA driver to allocate PCI vector dynamically
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250508/202505080049.7AvfzOGc-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250508/202505080049.7AvfzOGc-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/202505080049.7AvfzOGc-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/microsoft/mana/gdma_main.c:500:2: warning: variable 'gic' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
500 | list_for_each(pos, &gc->irq_contexts) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:687:27: note: expanded from macro 'list_for_each'
687 | for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/microsoft/mana/gdma_main.c:510:7: note: uninitialized use occurs here
510 | if (!gic)
| ^~~
drivers/net/ethernet/microsoft/mana/gdma_main.c:500:2: note: remove the condition if it is always true
500 | list_for_each(pos, &gc->irq_contexts) {
| ^
include/linux/list.h:687:27: note: expanded from macro 'list_for_each'
687 | for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
| ^
drivers/net/ethernet/microsoft/mana/gdma_main.c:475:30: note: initialize the variable 'gic' to silence this warning
475 | struct gdma_irq_context *gic;
| ^
| = NULL
drivers/net/ethernet/microsoft/mana/gdma_main.c:541:2: warning: variable 'gic' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
541 | list_for_each(pos, &gc->irq_contexts) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:687:27: note: expanded from macro 'list_for_each'
687 | for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/microsoft/mana/gdma_main.c:551:7: note: uninitialized use occurs here
551 | if (!gic)
| ^~~
drivers/net/ethernet/microsoft/mana/gdma_main.c:541:2: note: remove the condition if it is always true
541 | list_for_each(pos, &gc->irq_contexts) {
| ^
include/linux/list.h:687:27: note: expanded from macro 'list_for_each'
687 | for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
| ^
drivers/net/ethernet/microsoft/mana/gdma_main.c:523:30: note: initialize the variable 'gic' to silence this warning
523 | struct gdma_irq_context *gic;
| ^
| = NULL
2 warnings generated.

vim +500 drivers/net/ethernet/microsoft/mana/gdma_main.c

470
471 static int mana_gd_register_irq(struct gdma_queue *queue,
472 const struct gdma_queue_spec *spec)
473 {
474 struct gdma_dev *gd = queue->gdma_dev;
475 struct gdma_irq_context *gic;
476 struct gdma_context *gc;
477 unsigned int msi_index;
478 struct list_head *pos;
479 unsigned long flags, flag_irq;
480 struct device *dev;
481 int err = 0, count;
482
483 gc = gd->gdma_context;
484 dev = gc->dev;
485 msi_index = spec->eq.msix_index;
486
487 if (msi_index >= gc->num_msix_usable) {
488 err = -ENOSPC;
489 dev_err(dev, "Register IRQ err:%d, msi:%u nMSI:%u",
490 err, msi_index, gc->num_msix_usable);
491
492 return err;
493 }
494
495 queue->eq.msix_index = msi_index;
496
497 /* get the msi_index value from the list*/
498 count = 0;
499 spin_lock_irqsave(&gc->irq_ctxs_lock, flag_irq);
> 500 list_for_each(pos, &gc->irq_contexts) {
501 if (count == msi_index) {
502 gic = list_entry(pos, struct gdma_irq_context, gic_list);
503 break;
504 }
505
506 count++;
507 }
508 spin_unlock_irqrestore(&gc->irq_ctxs_lock, flag_irq);
509
510 if (!gic)
511 return -1;
512
513 spin_lock_irqsave(&gic->lock, flags);
514 list_add_rcu(&queue->entry, &gic->eq_list);
515 spin_unlock_irqrestore(&gic->lock, flags);
516
517 return 0;
518 }
519

--
0-DAY CI Kernel Test Service