[driver-core:debugfs_cleanup 6/7] drivers/nvmem/core.c:480:8: error: call to undeclared function 'devm_device_add_groups'; ISO C99 and later do not support implicit function declarations

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_cleanup
head:   dfca47ec5332bac3ee306ae2ba95a89765a801b7
commit: 2f0ece8a0f81650915d6252d146d32fe8162f112 [6/7] driver core: remove devm_device_add_groups()
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240125/202401251023.4INLLZvR-lkp@xxxxxxxxx/config)
compiler: ClangBuiltLinux 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/20240125/202401251023.4INLLZvR-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/202401251023.4INLLZvR-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/nvmem/core.c:480:8: error: call to undeclared function 'devm_device_add_groups'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     480 |         ret = devm_device_add_groups(&nvmem->dev, nvmem_cells_groups);
         |               ^
   drivers/nvmem/core.c:480:8: note: did you mean 'devm_device_add_group'?
   include/linux/device.h:1204:18: note: 'devm_device_add_group' declared here
    1204 | int __must_check devm_device_add_group(struct device *dev,
         |                  ^
   1 error generated.


vim +/devm_device_add_groups +480 drivers/nvmem/core.c

84400305271937 Srinivas Kandagatla 2020-03-25  429  
0331c611949fff Miquel Raynal       2023-12-15  430  static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
0331c611949fff Miquel Raynal       2023-12-15  431  {
0331c611949fff Miquel Raynal       2023-12-15  432  	struct bin_attribute **cells_attrs, *attrs;
0331c611949fff Miquel Raynal       2023-12-15  433  	struct nvmem_cell_entry *entry;
0331c611949fff Miquel Raynal       2023-12-15  434  	unsigned int ncells = 0, i = 0;
0331c611949fff Miquel Raynal       2023-12-15  435  	int ret = 0;
0331c611949fff Miquel Raynal       2023-12-15  436  
0331c611949fff Miquel Raynal       2023-12-15  437  	mutex_lock(&nvmem_mutex);
0331c611949fff Miquel Raynal       2023-12-15  438  
0331c611949fff Miquel Raynal       2023-12-15  439  	if (list_empty(&nvmem->cells) || nvmem->sysfs_cells_populated) {
0331c611949fff Miquel Raynal       2023-12-15  440  		nvmem_cells_group.bin_attrs = NULL;
0331c611949fff Miquel Raynal       2023-12-15  441  		goto unlock_mutex;
0331c611949fff Miquel Raynal       2023-12-15  442  	}
0331c611949fff Miquel Raynal       2023-12-15  443  
0331c611949fff Miquel Raynal       2023-12-15  444  	/* Allocate an array of attributes with a sentinel */
0331c611949fff Miquel Raynal       2023-12-15  445  	ncells = list_count_nodes(&nvmem->cells);
0331c611949fff Miquel Raynal       2023-12-15  446  	cells_attrs = devm_kcalloc(&nvmem->dev, ncells + 1,
0331c611949fff Miquel Raynal       2023-12-15  447  				   sizeof(struct bin_attribute *), GFP_KERNEL);
0331c611949fff Miquel Raynal       2023-12-15  448  	if (!cells_attrs) {
0331c611949fff Miquel Raynal       2023-12-15  449  		ret = -ENOMEM;
0331c611949fff Miquel Raynal       2023-12-15  450  		goto unlock_mutex;
0331c611949fff Miquel Raynal       2023-12-15  451  	}
0331c611949fff Miquel Raynal       2023-12-15  452  
0331c611949fff Miquel Raynal       2023-12-15  453  	attrs = devm_kcalloc(&nvmem->dev, ncells, sizeof(struct bin_attribute), GFP_KERNEL);
0331c611949fff Miquel Raynal       2023-12-15  454  	if (!attrs) {
0331c611949fff Miquel Raynal       2023-12-15  455  		ret = -ENOMEM;
0331c611949fff Miquel Raynal       2023-12-15  456  		goto unlock_mutex;
0331c611949fff Miquel Raynal       2023-12-15  457  	}
0331c611949fff Miquel Raynal       2023-12-15  458  
0331c611949fff Miquel Raynal       2023-12-15  459  	/* Initialize each attribute to take the name and size of the cell */
0331c611949fff Miquel Raynal       2023-12-15  460  	list_for_each_entry(entry, &nvmem->cells, node) {
0331c611949fff Miquel Raynal       2023-12-15  461  		sysfs_bin_attr_init(&attrs[i]);
0331c611949fff Miquel Raynal       2023-12-15  462  		attrs[i].attr.name = devm_kasprintf(&nvmem->dev, GFP_KERNEL,
0331c611949fff Miquel Raynal       2023-12-15  463  						    "%s@%x", entry->name,
0331c611949fff Miquel Raynal       2023-12-15  464  						    entry->offset);
0331c611949fff Miquel Raynal       2023-12-15  465  		attrs[i].attr.mode = 0444;
0331c611949fff Miquel Raynal       2023-12-15  466  		attrs[i].size = entry->bytes;
0331c611949fff Miquel Raynal       2023-12-15  467  		attrs[i].read = &nvmem_cell_attr_read;
0331c611949fff Miquel Raynal       2023-12-15  468  		attrs[i].private = entry;
0331c611949fff Miquel Raynal       2023-12-15  469  		if (!attrs[i].attr.name) {
0331c611949fff Miquel Raynal       2023-12-15  470  			ret = -ENOMEM;
0331c611949fff Miquel Raynal       2023-12-15  471  			goto unlock_mutex;
0331c611949fff Miquel Raynal       2023-12-15  472  		}
0331c611949fff Miquel Raynal       2023-12-15  473  
0331c611949fff Miquel Raynal       2023-12-15  474  		cells_attrs[i] = &attrs[i];
0331c611949fff Miquel Raynal       2023-12-15  475  		i++;
0331c611949fff Miquel Raynal       2023-12-15  476  	}
0331c611949fff Miquel Raynal       2023-12-15  477  
0331c611949fff Miquel Raynal       2023-12-15  478  	nvmem_cells_group.bin_attrs = cells_attrs;
0331c611949fff Miquel Raynal       2023-12-15  479  
0331c611949fff Miquel Raynal       2023-12-15 @480  	ret = devm_device_add_groups(&nvmem->dev, nvmem_cells_groups);
0331c611949fff Miquel Raynal       2023-12-15  481  	if (ret)
0331c611949fff Miquel Raynal       2023-12-15  482  		goto unlock_mutex;
0331c611949fff Miquel Raynal       2023-12-15  483  
0331c611949fff Miquel Raynal       2023-12-15  484  	nvmem->sysfs_cells_populated = true;
0331c611949fff Miquel Raynal       2023-12-15  485  
0331c611949fff Miquel Raynal       2023-12-15  486  unlock_mutex:
0331c611949fff Miquel Raynal       2023-12-15  487  	mutex_unlock(&nvmem_mutex);
0331c611949fff Miquel Raynal       2023-12-15  488  
0331c611949fff Miquel Raynal       2023-12-15  489  	return ret;
0331c611949fff Miquel Raynal       2023-12-15  490  }
0331c611949fff Miquel Raynal       2023-12-15  491  

:::::: The code at line 480 was first introduced by commit
:::::: 0331c611949fffdf486652450901a4dc52bc5cca nvmem: core: Expose cells through sysfs

:::::: TO: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux