[driver-core:class_cleanup 34/80] arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c:129:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false

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 class_cleanup
head:   c6dd61fdeee23ae8743e3ac8234ab05f94bcc601
commit: c93bd175414ac43d7ea6cb2a17f49eb91af03f00 [34/80] powerpc/fsl: move to use bus_get_dev_root()
config: powerpc-randconfig-r003-20230326 (https://download.01.org/0day-ci/archive/20230328/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?id=c93bd175414ac43d7ea6cb2a17f49eb91af03f00
        git remote add driver-core https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
        git fetch --no-tags driver-core class_cleanup
        git checkout c93bd175414ac43d7ea6cb2a17f49eb91af03f00
        # 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=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/sysdev/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c:129:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
           if (dev_root) {
               ^~~~~~~~
   arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c:136:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c:129:2: note: remove the 'if' if its condition is always true
           if (dev_root) {
           ^~~~~~~~~~~~~~
   arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c:120:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 error generated.


vim +129 arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c

   113	
   114	static struct device_attribute mpic_attributes = __ATTR(timer_wakeup, 0644,
   115				fsl_timer_wakeup_show, fsl_timer_wakeup_store);
   116	
   117	static int __init fsl_wakeup_sys_init(void)
   118	{
   119		struct device *dev_root;
   120		int ret;
   121	
   122		fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL);
   123		if (!fsl_wakeup)
   124			return -ENOMEM;
   125	
   126		INIT_WORK(&fsl_wakeup->free_work, fsl_free_resource);
   127	
   128		dev_root = bus_get_dev_root(&mpic_subsys);
 > 129		if (dev_root) {
   130			ret = device_create_file(dev_root, &mpic_attributes);
   131			put_device(dev_root);
   132			if (ret)
   133				kfree(fsl_wakeup);
   134		}
   135	
   136		return ret;
   137	}
   138	

-- 
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
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.