Re: [PATCH v2 2/8] video: Provide screen_info_get_pci_dev() to find screen_info's PCI device

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

 



Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm-tip/drm-tip linus/master v6.8-rc2 next-20240202]
[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/Thomas-Zimmermann/video-Add-helpers-for-decoding-screen_info/20240202-200314
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20240202120140.3517-3-tzimmermann%40suse.de
patch subject: [PATCH v2 2/8] video: Provide screen_info_get_pci_dev() to find screen_info's PCI device
config: i386-buildonly-randconfig-004-20240203 (https://download.01.org/0day-ci/archive/20240204/202402040957.xNqUV75N-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240204/202402040957.xNqUV75N-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402040957.xNqUV75N-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/video/screen_info_pci.c:10:6: warning: variable 'pdev' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      10 |         if (!(res->flags & IORESOURCE_MEM))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/video/screen_info_pci.c:13:19: note: uninitialized use occurs here
      13 |         for_each_pci_dev(pdev) {
         |                          ^~~~
   include/linux/pci.h:546:80: note: expanded from macro 'for_each_pci_dev'
     546 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
         |                                                                                ^
   drivers/video/screen_info_pci.c:10:2: note: remove the 'if' if its condition is always true
      10 |         if (!(res->flags & IORESOURCE_MEM))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      11 |                 return NULL;
   drivers/video/screen_info_pci.c:8:22: note: initialize the variable 'pdev' to silence this warning
       8 |         struct pci_dev *pdev;
         |                             ^
         |                              = NULL
   1 warning generated.


vim +10 drivers/video/screen_info_pci.c

     5	
     6	static struct pci_dev *__screen_info_pci_dev(struct resource *res)
     7	{
     8		struct pci_dev *pdev;
     9	
  > 10		if (!(res->flags & IORESOURCE_MEM))
    11			return NULL;
    12	
    13		for_each_pci_dev(pdev) {
    14			const struct resource *r;
    15	
    16			if ((pdev->class >> 16) != PCI_BASE_CLASS_DISPLAY)
    17				continue;
    18	
    19			r = pci_find_resource(pdev, res);
    20			if (r)
    21				return pdev;
    22		}
    23	
    24		return NULL;
    25	}
    26	

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



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux