Re: [PATCH v2 2/4] PCI: Move jailhouse's isolated function handling to pci_scan_slot()

Niklas Schnelle
2022-04-13T07:56:14Z

On Wed, 2022-04-13 at 00:28 +0800, kernel test robot wrote:
> Hi Niklas,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on helgaas-pci/next]
> [also build test WARNING on s390/features tip/x86/core v5.18-rc2 next-20220412]
> [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]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Niklas-Schnelle/PCI-Rework-pci_scan_slot-and-isolated-PCI-functions/20220412-223307
> base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> config: alpha-defconfig (https://download.01.org/0day-ci/archive/20220413/202204130045.AeSigvk8-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 11.2.0
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/5cac6729750b7434ff5d6ae99469e9e54bc9fb6e
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Niklas-Schnelle/PCI-Rework-pci_scan_slot-and-isolated-PCI-functions/20220412-223307
> git checkout 5cac6729750b7434ff5d6ae99469e9e54bc9fb6e
> # save the config file to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha SHELL=/bin/bash drivers/pci/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> drivers/pci/probe.c: In function 'pci_scan_child_bus_extend':
> > > drivers/pci/probe.c:2861:13: warning: variable 'nr_devs' set but not used [-Wunused-but-set-variable]
> 2861 | int nr_devs;
> | ^~~~~~~
>
>
> vim +/nr_devs +2861 drivers/pci/probe.c
>
> bccf90d6e063d2 Palmer Dabbelt 2017-06-23 2841
> 1c02ea81006548 Mika Westerberg 2017-10-13 2842 /**
> 1c02ea81006548 Mika Westerberg 2017-10-13 2843 * pci_scan_child_bus_extend() - Scan devices below a bus
> 1c02ea81006548 Mika Westerberg 2017-10-13 2844 * @bus: Bus to scan for devices
> 1c02ea81006548 Mika Westerberg 2017-10-13 2845 * @available_buses: Total number of buses available (%0 does not try to
> 1c02ea81006548 Mika Westerberg 2017-10-13 2846 * extend beyond the minimal)
> 1c02ea81006548 Mika Westerberg 2017-10-13 2847 *
> 1c02ea81006548 Mika Westerberg 2017-10-13 2848 * Scans devices below @bus including subordinate buses. Returns new
> 1c02ea81006548 Mika Westerberg 2017-10-13 2849 * subordinate number including all the found devices. Passing
> 1c02ea81006548 Mika Westerberg 2017-10-13 2850 * @available_buses causes the remaining bus space to be distributed
> 1c02ea81006548 Mika Westerberg 2017-10-13 2851 * equally between hotplug-capable bridges to allow future extension of the
> 1c02ea81006548 Mika Westerberg 2017-10-13 2852 * hierarchy.
> 1c02ea81006548 Mika Westerberg 2017-10-13 2853 */
> 1c02ea81006548 Mika Westerberg 2017-10-13 2854 static unsigned int pci_scan_child_bus_extend(struct pci_bus *bus,
> 1c02ea81006548 Mika Westerberg 2017-10-13 2855 unsigned int available_buses)
> 1c02ea81006548 Mika Westerberg 2017-10-13 2856 {
> 1c02ea81006548 Mika Westerberg 2017-10-13 2857 unsigned int used_buses, normal_bridges = 0, hotplug_bridges = 0;
> 1c02ea81006548 Mika Westerberg 2017-10-13 2858 unsigned int start = bus->busn_res.start;
> 5cac6729750b74 Niklas Schnelle 2022-04-12 2859 unsigned int devfn, cmax, max = start;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16 2860 struct pci_dev *dev;
> 690f4304104f37 Jan Kiszka 2018-03-07 @2861 int nr_devs;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16 2862
> 0207c356ef0e2b Bjorn Helgaas 2009-11-04 2863 dev_dbg(&bus->dev, "scanning bus\n");
> ^1da177e4c3f41 Linus Torvalds 2005-04-16 2864
> ^1da177e4c3f41 Linus Torvalds 2005-04-16 2865 /* Go find them, Rover! */
> 5cac6729750b74 Niklas Schnelle 2022-04-12 2866 for (devfn = 0; devfn < 256; devfn += 8)
> 690f4304104f37 Jan Kiszka 2018-03-07 2867 nr_devs = pci_scan_slot(bus, devfn);

The bot is right, the nr_devs can be removed as the patch removed the
only read access did so locally already.