[android-common:android-mainline-riscv64 0/1] drivers/pci/pci.c:426:9: warning: indirection of non-volatile null pointer will be deleted, not trap

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
Hi Carlos,

FYI, the error/warning still remains.

tree:   https://android.googlesource.com/kernel/common android-mainline-riscv64
head:   ff926f685d34996e7004a0e23d1c41ddf840c8e4
commit: e2f7a805a3cbfa7a546334d3409745e0b2037524 [0/1] Merge 1c2b4a4c2bcb ("Merge tag 'pci-v7.0-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci") into android-mainline
config: x86_64-randconfig-014-20260822 (https://download.01.org/0day-ci/archive/20260822/[email protected]/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260822/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   In file included from drivers/pci/pci.c:16:
   include/linux/iommu.h:1627:17: error: incomplete definition of type 'struct iommu_mm_data'
    1627 |         return iommu_mm->pasid;
         |                ~~~~~~~~^
   include/linux/mm_types.h:1074:8: note: forward declaration of 'struct iommu_mm_data'
    1074 | struct iommu_mm_data;
         |        ^
>> drivers/pci/pci.c:426:9: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
     426 |         return PCI_FIND_NEXT_CAP(pci_bus_read_config, pos, cap, NULL, bus, devfn);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/pci.h:159:5: note: expanded from macro 'PCI_FIND_NEXT_CAP'
     159 |                                 *(u8 *)prev_ptr = __prev_pos;           \
         |                                 ^~~~~~~~~~~~~~~
   drivers/pci/pci.c:426:9: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
   drivers/pci/pci.h:159:5: note: expanded from macro 'PCI_FIND_NEXT_CAP'
     159 |                                 *(u8 *)prev_ptr = __prev_pos;           \
         |                                 ^
   drivers/pci/pci.c:530:9: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
     530 |         return PCI_FIND_NEXT_EXT_CAP(pci_bus_read_config, start, cap,
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     531 |                                      NULL, dev->bus, dev->devfn);
         |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/pci.h:207:5: note: expanded from macro 'PCI_FIND_NEXT_EXT_CAP'
     207 |                                 *(u16 *)prev_ptr = __prev_pos;          \
         |                                 ^~~~~~~~~~~~~~~~
   drivers/pci/pci.c:530:9: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
   drivers/pci/pci.h:207:5: note: expanded from macro 'PCI_FIND_NEXT_EXT_CAP'
     207 |                                 *(u16 *)prev_ptr = __prev_pos;          \
         |                                 ^
   drivers/pci/pci.c:599:8: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
     599 |         pos = PCI_FIND_NEXT_CAP(pci_bus_read_config, pos,
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     600 |                                 PCI_CAP_ID_HT, NULL, dev->bus, dev->devfn);
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/pci.h:159:5: note: expanded from macro 'PCI_FIND_NEXT_CAP'
     159 |                                 *(u8 *)prev_ptr = __prev_pos;           \
         |                                 ^~~~~~~~~~~~~~~
   drivers/pci/pci.c:599:8: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
   drivers/pci/pci.h:159:5: note: expanded from macro 'PCI_FIND_NEXT_CAP'
     159 |                                 *(u8 *)prev_ptr = __prev_pos;           \
         |                                 ^
   drivers/pci/pci.c:609:9: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
     609 |                 pos = PCI_FIND_NEXT_CAP(pci_bus_read_config,
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     610 |                                         pos + PCI_CAP_LIST_NEXT,
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~
     611 |                                         PCI_CAP_ID_HT, NULL, dev->bus,
         |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     612 |                                         dev->devfn);
         |                                         ~~~~~~~~~~~
   drivers/pci/pci.h:159:5: note: expanded from macro 'PCI_FIND_NEXT_CAP'
     159 |                                 *(u8 *)prev_ptr = __prev_pos;           \
         |                                 ^~~~~~~~~~~~~~~
   drivers/pci/pci.c:609:9: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
   drivers/pci/pci.h:159:5: note: expanded from macro 'PCI_FIND_NEXT_CAP'
     159 |                                 *(u8 *)prev_ptr = __prev_pos;           \
         |                                 ^
   4 warnings and 1 error generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for BALLOON_COMPACTION
   Depends on [n]: COMPACTION [=n] && MEMORY_BALLOON [=y]
   Selected by [y]:
   - GKI_HIDDEN_MM_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for SND_PCM_ELD
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for SND_PCM_IEC958
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_SOC_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for IOMMU_SVA
   Depends on [n]: IOMMU_SUPPORT [=n]
   Selected by [y]:
   - GKI_HIDDEN_IOMMU_CONFIGS [=y] && (ARM64 || X86 [=y])
   WARNING: unmet direct dependencies detected for SND_COMPRESS_ACCEL
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for SND_JACK
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for SND_VMASTER
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for CAN_RX_OFFLOAD
   Depends on [n]: NETDEVICES [=y] && CAN_DEV [=n] && CAN_NETLINK [=n]
   Selected by [y]:
   - GKI_HIDDEN_MCP251XFD_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for SND_JACK_INPUT_DEV
   Depends on [n]: SOUND [=n] && SND [=n] && SND_JACK [=y]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y]
   WARNING: unmet direct dependencies detected for SND_INTEL_NHLT
   Depends on [n]: SOUND [=n] && SND [=n]
   Selected by [y]:
   - GKI_HIDDEN_SND_CONFIGS [=y] && ACPI [=y]


vim +426 drivers/pci/pci.c

687d5fe3dc3379 Michael Ellerman 2006-11-22  422  
f646c2a0a6685a Puranjay Mohan   2020-11-29  423  static u8 __pci_find_next_cap(struct pci_bus *bus, unsigned int devfn,
687d5fe3dc3379 Michael Ellerman 2006-11-22  424  			      u8 pos, int cap)
687d5fe3dc3379 Michael Ellerman 2006-11-22  425  {
a2582e05e39adf Qiang Yu         2025-11-09 @426  	return PCI_FIND_NEXT_CAP(pci_bus_read_config, pos, cap, NULL, bus, devfn);
687d5fe3dc3379 Michael Ellerman 2006-11-22  427  }
687d5fe3dc3379 Michael Ellerman 2006-11-22  428  

:::::: The code at line 426 was first introduced by commit
:::::: a2582e05e39adf9ab82a02561cd6f70738540ae0 PCI: Add preceding capability position support in PCI_FIND_NEXT_*_CAP macros

:::::: TO: Qiang Yu <[email protected]>
:::::: CC: Manivannan Sadhasivam <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.