[pci:kwilczynski/sysfs-static-resource-attributes 11/11] drivers/pci/pci-sysfs.c:971:10: error: 'struct pci_bus' has no member named 'legacy_io'

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git kwilczynski/sysfs-static-resource-attributes
head:   7f395964ea2fe94ad5099688ff13d6ba89c68f97
commit: fde9d2216e37abdc20fdbb73878fa040f751cb42 [11/11] PCI/sysfs: Limit pci_sysfs_init() late initcall compile time scope
config: powerpc-randconfig-001-20240619 (https://download.01.org/0day-ci/archive/20240619/202406191615.C3UP7pEc-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240619/202406191615.C3UP7pEc-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/202406191615.C3UP7pEc-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/pci/pci-sysfs.c: In function 'pci_create_legacy_files':
>> drivers/pci/pci-sysfs.c:971:10: error: 'struct pci_bus' has no member named 'legacy_io'
     971 |         b->legacy_io = kcalloc(2, sizeof(struct bin_attribute),
         |          ^~
   drivers/pci/pci-sysfs.c:973:15: error: 'struct pci_bus' has no member named 'legacy_io'
     973 |         if (!b->legacy_io)
         |               ^~
   In file included from include/linux/kobject.h:20,
                    from include/linux/pci.h:35,
                    from drivers/pci/pci-sysfs.c:18:
   drivers/pci/pci-sysfs.c:976:30: error: 'struct pci_bus' has no member named 'legacy_io'
     976 |         sysfs_bin_attr_init(b->legacy_io);
         |                              ^~
   include/linux/sysfs.h:55:10: note: in definition of macro 'sysfs_attr_init'
      55 |         (attr)->key = &__key;                           \
         |          ^~~~
   drivers/pci/pci-sysfs.c:976:9: note: in expansion of macro 'sysfs_bin_attr_init'
     976 |         sysfs_bin_attr_init(b->legacy_io);
         |         ^~~~~~~~~~~~~~~~~~~
   drivers/pci/pci-sysfs.c:977:10: error: 'struct pci_bus' has no member named 'legacy_io'
     977 |         b->legacy_io->attr.name = "legacy_io";
         |          ^~
   drivers/pci/pci-sysfs.c:978:10: error: 'struct pci_bus' has no member named 'legacy_io'
     978 |         b->legacy_io->size = 0xffff;
         |          ^~
   drivers/pci/pci-sysfs.c:979:10: error: 'struct pci_bus' has no member named 'legacy_io'
     979 |         b->legacy_io->attr.mode = 0600;
         |          ^~
   drivers/pci/pci-sysfs.c:980:10: error: 'struct pci_bus' has no member named 'legacy_io'
     980 |         b->legacy_io->read = pci_read_legacy_io;
         |          ^~
   drivers/pci/pci-sysfs.c:981:10: error: 'struct pci_bus' has no member named 'legacy_io'
     981 |         b->legacy_io->write = pci_write_legacy_io;
         |          ^~
   drivers/pci/pci-sysfs.c:983:10: error: 'struct pci_bus' has no member named 'legacy_io'
     983 |         b->legacy_io->llseek = pci_llseek_resource;
         |          ^~
   drivers/pci/pci-sysfs.c:984:10: error: 'struct pci_bus' has no member named 'legacy_io'
     984 |         b->legacy_io->mmap = pci_mmap_legacy_io;
         |          ^~
   drivers/pci/pci-sysfs.c:985:10: error: 'struct pci_bus' has no member named 'legacy_io'
     985 |         b->legacy_io->f_mapping = iomem_get_mapping;
         |          ^~
   drivers/pci/pci-sysfs.c:987:50: error: 'struct pci_bus' has no member named 'legacy_io'
     987 |         error = device_create_bin_file(&b->dev, b->legacy_io);
         |                                                  ^~
>> drivers/pci/pci-sysfs.c:992:10: error: 'struct pci_bus' has no member named 'legacy_mem'
     992 |         b->legacy_mem = b->legacy_io + 1;
         |          ^~
   drivers/pci/pci-sysfs.c:992:26: error: 'struct pci_bus' has no member named 'legacy_io'
     992 |         b->legacy_mem = b->legacy_io + 1;
         |                          ^~
   drivers/pci/pci-sysfs.c:993:30: error: 'struct pci_bus' has no member named 'legacy_mem'
     993 |         sysfs_bin_attr_init(b->legacy_mem);
         |                              ^~
   include/linux/sysfs.h:55:10: note: in definition of macro 'sysfs_attr_init'
      55 |         (attr)->key = &__key;                           \
         |          ^~~~
   drivers/pci/pci-sysfs.c:993:9: note: in expansion of macro 'sysfs_bin_attr_init'
     993 |         sysfs_bin_attr_init(b->legacy_mem);
         |         ^~~~~~~~~~~~~~~~~~~
   drivers/pci/pci-sysfs.c:994:10: error: 'struct pci_bus' has no member named 'legacy_mem'
     994 |         b->legacy_mem->attr.name = "legacy_mem";
         |          ^~
   drivers/pci/pci-sysfs.c:995:10: error: 'struct pci_bus' has no member named 'legacy_mem'
     995 |         b->legacy_mem->size = 1024*1024;
         |          ^~
   drivers/pci/pci-sysfs.c:996:10: error: 'struct pci_bus' has no member named 'legacy_mem'
     996 |         b->legacy_mem->attr.mode = 0600;
         |          ^~
   drivers/pci/pci-sysfs.c:997:10: error: 'struct pci_bus' has no member named 'legacy_mem'
     997 |         b->legacy_mem->mmap = pci_mmap_legacy_mem;
         |          ^~
   drivers/pci/pci-sysfs.c:999:10: error: 'struct pci_bus' has no member named 'legacy_mem'
     999 |         b->legacy_mem->llseek = pci_llseek_resource;
         |          ^~
   drivers/pci/pci-sysfs.c:1000:10: error: 'struct pci_bus' has no member named 'legacy_mem'
    1000 |         b->legacy_mem->f_mapping = iomem_get_mapping;
         |          ^~
   drivers/pci/pci-sysfs.c:1002:50: error: 'struct pci_bus' has no member named 'legacy_mem'
    1002 |         error = device_create_bin_file(&b->dev, b->legacy_mem);
         |                                                  ^~
   drivers/pci/pci-sysfs.c:1009:42: error: 'struct pci_bus' has no member named 'legacy_io'
    1009 |         device_remove_bin_file(&b->dev, b->legacy_io);
         |                                          ^~
   drivers/pci/pci-sysfs.c:1011:16: error: 'struct pci_bus' has no member named 'legacy_io'
    1011 |         kfree(b->legacy_io);
         |                ^~
   drivers/pci/pci-sysfs.c:1012:10: error: 'struct pci_bus' has no member named 'legacy_io'
    1012 |         b->legacy_io = NULL;
         |          ^~
   drivers/pci/pci-sysfs.c: In function 'pci_remove_legacy_files':
   drivers/pci/pci-sysfs.c:1019:14: error: 'struct pci_bus' has no member named 'legacy_io'
    1019 |         if (b->legacy_io) {
         |              ^~
   drivers/pci/pci-sysfs.c:1020:50: error: 'struct pci_bus' has no member named 'legacy_io'
    1020 |                 device_remove_bin_file(&b->dev, b->legacy_io);
         |                                                  ^~
   drivers/pci/pci-sysfs.c:1021:50: error: 'struct pci_bus' has no member named 'legacy_mem'
    1021 |                 device_remove_bin_file(&b->dev, b->legacy_mem);
         |                                                  ^~
   drivers/pci/pci-sysfs.c:1022:24: error: 'struct pci_bus' has no member named 'legacy_io'
    1022 |                 kfree(b->legacy_io); /* both are allocated here */
         |                        ^~


vim +971 drivers/pci/pci-sysfs.c

10a0ef39fbd1d4 Ivan Kokshaysky        2009-02-17   952  
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   953  /**
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   954   * pci_create_legacy_files - create legacy I/O port and memory files
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   955   * @b: bus to create files under
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   956   *
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   957   * Some platforms allow access to legacy I/O port and ISA memory space on
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   958   * a per-bus basis.  This routine creates the files and ties them into
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   959   * their associated read, write and mmap files from pci-sysfs.c
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   960   *
25985edcedea63 Lucas De Marchi        2011-03-30   961   * On error unwind, but don't propagate the error to the caller
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   962   * as it is ok to set up the PCI bus without these files.
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   963   */
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   964  void pci_create_legacy_files(struct pci_bus *b)
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   965  {
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   966  	int error;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   967  
efd532a679afae Daniel Vetter          2021-02-05   968  	if (!sysfs_initialized)
efd532a679afae Daniel Vetter          2021-02-05   969  		return;
efd532a679afae Daniel Vetter          2021-02-05   970  
6396bb221514d2 Kees Cook              2018-06-12  @971  	b->legacy_io = kcalloc(2, sizeof(struct bin_attribute),
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   972  			       GFP_ATOMIC);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   973  	if (!b->legacy_io)
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   974  		goto kzalloc_err;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   975  
62e877b893e635 Stephen Rothwell       2010-03-01   976  	sysfs_bin_attr_init(b->legacy_io);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   977  	b->legacy_io->attr.name = "legacy_io";
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   978  	b->legacy_io->size = 0xffff;
e2154044dd4168 Kelsey Skunberg        2019-08-13   979  	b->legacy_io->attr.mode = 0600;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   980  	b->legacy_io->read = pci_read_legacy_io;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   981  	b->legacy_io->write = pci_write_legacy_io;
24de09c16f974d Valentine Sinitsyn     2023-09-25   982  	/* See pci_create_attr() for motivation */
24de09c16f974d Valentine Sinitsyn     2023-09-25   983  	b->legacy_io->llseek = pci_llseek_resource;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  @984  	b->legacy_io->mmap = pci_mmap_legacy_io;
f06aff924f9758 Krzysztof Wilczyński   2021-07-29   985  	b->legacy_io->f_mapping = iomem_get_mapping;
10a0ef39fbd1d4 Ivan Kokshaysky        2009-02-17   986  	pci_adjust_legacy_attr(b, pci_mmap_io);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   987  	error = device_create_bin_file(&b->dev, b->legacy_io);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   988  	if (error)
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   989  		goto legacy_io_err;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   990  
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   991  	/* Allocated above after the legacy_io struct */
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  @992  	b->legacy_mem = b->legacy_io + 1;
6757eca348fbbd Mel Gorman             2010-03-10   993  	sysfs_bin_attr_init(b->legacy_mem);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   994  	b->legacy_mem->attr.name = "legacy_mem";
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   995  	b->legacy_mem->size = 1024*1024;
e2154044dd4168 Kelsey Skunberg        2019-08-13   996  	b->legacy_mem->attr.mode = 0600;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03   997  	b->legacy_mem->mmap = pci_mmap_legacy_mem;
24de09c16f974d Valentine Sinitsyn     2023-09-25   998  	/* See pci_create_attr() for motivation */
24de09c16f974d Valentine Sinitsyn     2023-09-25   999  	b->legacy_mem->llseek = pci_llseek_resource;
c6c3c5704ba708 Linus Torvalds         2021-09-01  1000  	b->legacy_mem->f_mapping = iomem_get_mapping;
10a0ef39fbd1d4 Ivan Kokshaysky        2009-02-17  1001  	pci_adjust_legacy_attr(b, pci_mmap_mem);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1002  	error = device_create_bin_file(&b->dev, b->legacy_mem);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1003  	if (error)
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1004  		goto legacy_mem_err;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1005  
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1006  	return;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1007  
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1008  legacy_mem_err:
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1009  	device_remove_bin_file(&b->dev, b->legacy_io);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1010  legacy_io_err:
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1011  	kfree(b->legacy_io);
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1012  	b->legacy_io = NULL;
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1013  kzalloc_err:
7db4af43c97b68 Bjorn Helgaas          2019-05-07  1014  	dev_warn(&b->dev, "could not create legacy I/O port and ISA memory resources in sysfs\n");
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1015  }
f19aeb1f3638b7 Benjamin Herrenschmidt 2008-10-03  1016  

:::::: The code at line 971 was first introduced by commit
:::::: 6396bb221514d2876fd6dc0aa2a1f240d99b37bb treewide: kzalloc() -> kcalloc()

:::::: TO: Kees Cook <keescook@xxxxxxxxxxxx>
:::::: CC: Kees Cook <keescook@xxxxxxxxxxxx>

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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux