Re: [PATCH 2/5] driver core: separate function to shutdown one device

kernel test robot
2026-03-12T01:49:45Z

Hi David,

kernel test robot noticed the following build warnings:

[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on driver-core/driver-core-next driver-core/driver-core-linus jejb-scsi/for-next mkp-scsi/for-next linus/master v7.0-rc3 next-20260311]
[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/David-Jeffery/driver-core-separate-function-to-shutdown-one-device/20260312-011646
base: driver-core/driver-core-testing
patch link: https://lore.kernel.org/r/20260311171209.9205-2-djeffery%40redhat.com
patch subject: [PATCH 2/5] driver core: separate function to shutdown one device
config: arc-allnoconfig (https://download.01.org/0day-ci/archive/20260312/202603120917.gDcyYG9H-lkp@intel.com/config)
compiler: arc-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260312/202603120917.gDcyYG9H-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603120917.gDcyYG9H-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/base/core.c: In function 'device_shutdown':
>> drivers/base/core.c:4824:30: warning: variable 'parent' set but not used [-Wunused-but-set-variable]
4824 | struct device *dev, *parent;
| ^~~~~~

vim +/parent +4824 drivers/base/core.c

f9dcdf9ae03c40 David Jeffery 2026-03-11 4818
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4819 /**
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4820 * device_shutdown - call ->shutdown() on each device to shutdown.
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4821 */
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4822 void device_shutdown(void)
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4823 {
f123db8e9d6c84 Benson Leung 2013-09-24 @4824 struct device *dev, *parent;
6245838fe4d2ce Hugh Daschbach 2010-03-22 4825
3297c8fc65af5d Pingfan Liu 2018-07-19 4826 wait_for_device_probe();
3297c8fc65af5d Pingfan Liu 2018-07-19 4827 device_block_probing();
3297c8fc65af5d Pingfan Liu 2018-07-19 4828
65650b35133ff2 Rafael J. Wysocki 2019-10-09 4829 cpufreq_suspend();
65650b35133ff2 Rafael J. Wysocki 2019-10-09 4830
6245838fe4d2ce Hugh Daschbach 2010-03-22 4831 spin_lock(&devices_kset->list_lock);
6245838fe4d2ce Hugh Daschbach 2010-03-22 4832 /*
6245838fe4d2ce Hugh Daschbach 2010-03-22 4833 * Walk the devices list backward, shutting down each in turn.
6245838fe4d2ce Hugh Daschbach 2010-03-22 4834 * Beware that device unplug events may also start pulling
6245838fe4d2ce Hugh Daschbach 2010-03-22 4835 * devices offline, even as the system is shutting down.
6245838fe4d2ce Hugh Daschbach 2010-03-22 4836 */
6245838fe4d2ce Hugh Daschbach 2010-03-22 4837 while (!list_empty(&devices_kset->list)) {
6245838fe4d2ce Hugh Daschbach 2010-03-22 4838 dev = list_entry(devices_kset->list.prev, struct device,
6245838fe4d2ce Hugh Daschbach 2010-03-22 4839 kobj.entry);
d1c6c030fcec6f Ming Lei 2012-06-22 4840
d1c6c030fcec6f Ming Lei 2012-06-22 4841 /*
d1c6c030fcec6f Ming Lei 2012-06-22 4842 * hold reference count of device's parent to
d1c6c030fcec6f Ming Lei 2012-06-22 4843 * prevent it from being freed because parent's
d1c6c030fcec6f Ming Lei 2012-06-22 4844 * lock is to be held
d1c6c030fcec6f Ming Lei 2012-06-22 4845 */
f123db8e9d6c84 Benson Leung 2013-09-24 4846 parent = get_device(dev->parent);
6245838fe4d2ce Hugh Daschbach 2010-03-22 4847 get_device(dev);
6245838fe4d2ce Hugh Daschbach 2010-03-22 4848 /*
6245838fe4d2ce Hugh Daschbach 2010-03-22 4849 * Make sure the device is off the kset list, in the
6245838fe4d2ce Hugh Daschbach 2010-03-22 4850 * event that dev->*->shutdown() doesn't remove it.
6245838fe4d2ce Hugh Daschbach 2010-03-22 4851 */
6245838fe4d2ce Hugh Daschbach 2010-03-22 4852 list_del_init(&dev->kobj.entry);
6245838fe4d2ce Hugh Daschbach 2010-03-22 4853 spin_unlock(&devices_kset->list_lock);
fe6b91f47080eb Alan Stern 2011-12-06 4854
f9dcdf9ae03c40 David Jeffery 2026-03-11 4855 shutdown_one_device(dev);
6245838fe4d2ce Hugh Daschbach 2010-03-22 4856
6245838fe4d2ce Hugh Daschbach 2010-03-22 4857 spin_lock(&devices_kset->list_lock);
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4858 }
6245838fe4d2ce Hugh Daschbach 2010-03-22 4859 spin_unlock(&devices_kset->list_lock);
37b0c020343080 Greg Kroah-Hartman 2007-11-26 4860 }
99bcf217183e02 Joe Perches 2010-06-27 4861

--
0-DAY CI Kernel Test Service