[driver-core:kobject-const 18/18] drivers/base/bus.c:59:18: warning: variable 'bus' is uninitialized when used here

kernel test robot <[email protected]>
Newsgroups org.linuxdriverproject.driverdev-devel,dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git kobject-const
head:   f9956a1c00eef96ea3fdf5395852e4ff902f3a76
commit: f9956a1c00eef96ea3fdf5395852e4ff902f3a76 [18/18] bus: step 1
config: hexagon-randconfig-r045-20230108
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 8d9828ef5aa9688500657d36cd2aefbe12bbd162)
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://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?id=f9956a1c00eef96ea3fdf5395852e4ff902f3a76
        git remote add driver-core https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
        git fetch --no-tags driver-core kobject-const
        git checkout f9956a1c00eef96ea3fdf5395852e4ff902f3a76
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/base/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> drivers/base/bus.c:59:18: warning: variable 'bus' is uninitialized when used here [-Wuninitialized]
                   if (sp->bus == bus)
                                  ^~~
   drivers/base/bus.c:47:22: note: initialize the variable 'bus' to silence this warning
           struct bus_type *bus;
                               ^
                                = NULL
   1 warning generated.


vim +/bus +59 drivers/base/bus.c

    44	
    45	static struct subsys_private *bus_to_subsys(const struct bus_type *b)
    46	{
    47		struct bus_type *bus;
    48		struct subsys_private *sp = NULL;
    49	
    50		if (!b)
    51			return NULL;
    52	
    53		mutex_lock(&subsys_list_lock);
    54	
    55		if (list_empty(&subsys_list))
    56			goto done;
    57	
    58		list_for_each_entry(sp, &subsys_list, bus_list_node) {
  > 59			if (sp->bus == bus)
    60				goto done;
    61		}
    62		sp = NULL;
    63	done:
    64		mutex_unlock(&subsys_list_lock);
    65		return sp;
    66	}
    67	

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

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
config (text/plain, 142 KB) - not displayed
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.