All of lore.kernel.org
 help / color / mirror / Atom feed
* [dinguyen:v5.10_socfpga_reset_fix 1/1] drivers/reset/reset-socfpga.c:35:6: warning: variable 'size' is used uninitialized whenever 'if' condition is true
@ 2020-10-28  5:24 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-10-28  5:24 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6243 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git v5.10_socfpga_reset_fix
head:   2e7fffa64d1ec2ecb8bc368ec37e5ae2ac8cc6a1
commit: 2e7fffa64d1ec2ecb8bc368ec37e5ae2ac8cc6a1 [1/1] reset: socfpga: add error handling and release mem-region
config: x86_64-randconfig-a006-20201026 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 50dfa19cc799ae7cddd39a95dbfce675a12672ad)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git/commit/?id=2e7fffa64d1ec2ecb8bc368ec37e5ae2ac8cc6a1
        git remote add dinguyen https://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
        git fetch --no-tags dinguyen v5.10_socfpga_reset_fix
        git checkout 2e7fffa64d1ec2ecb8bc368ec37e5ae2ac8cc6a1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/reset/reset-socfpga.c:35:6: warning: variable 'size' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (ret)
               ^~~
   drivers/reset/reset-socfpga.c:69:32: note: uninitialized use occurs here
           release_mem_region(res.start, size);
                                         ^~~~
   include/linux/ioport.h:249:81: note: expanded from macro 'release_mem_region'
   #define release_mem_region(start,n)     __release_region(&iomem_resource, (start), (n))
                                                                                       ^
   drivers/reset/reset-socfpga.c:35:2: note: remove the 'if' if its condition is always false
           if (ret)
           ^~~~~~~~
   drivers/reset/reset-socfpga.c:26:22: note: initialize the variable 'size' to silence this warning
           resource_size_t size;
                               ^
                                = 0
   1 warning generated.

vim +35 drivers/reset/reset-socfpga.c

b3ca9888f35fa6 Dinh Nguyen 2018-11-13  21  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  22  static int a10_reset_init(struct device_node *np)
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  23  {
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  24  	struct reset_simple_data *data;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  25  	struct resource res;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  26  	resource_size_t size;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  27  	int ret;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  28  	u32 reg_offset = 0x10;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  29  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  30  	data = kzalloc(sizeof(*data), GFP_KERNEL);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  31  	if (!data)
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  32  		return -ENOMEM;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  33  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  34  	ret = of_address_to_resource(np, 0, &res);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13 @35  	if (ret)
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  36  		goto err_alloc;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  37  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  38  	size = resource_size(&res);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  39  	if (!request_mem_region(res.start, size, np->name)) {
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  40  		ret = -EBUSY;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  41  		goto err_alloc;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  42  	}
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  43  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  44  	data->membase = ioremap(res.start, size);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  45  	if (!data->membase) {
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  46  		ret = -ENOMEM;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  47  		goto err_alloc;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  48  	}
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  49  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  50  	if (of_property_read_u32(np, "altr,modrst-offset", &reg_offset))
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  51  		pr_warn("missing altr,modrst-offset property, assuming 0x10\n");
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  52  	data->membase += reg_offset;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  53  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  54  	spin_lock_init(&data->lock);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  55  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  56  	data->rcdev.owner = THIS_MODULE;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  57  	data->rcdev.nr_resets = SOCFPGA_NR_BANKS * 32;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  58  	data->rcdev.ops = &reset_simple_ops;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  59  	data->rcdev.of_node = np;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  60  	data->status_active_low = true;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  61  
2e7fffa64d1ec2 Dinh Nguyen 2020-10-27  62  	ret = reset_controller_register(&data->rcdev);
2e7fffa64d1ec2 Dinh Nguyen 2020-10-27  63  	if (ret)
2e7fffa64d1ec2 Dinh Nguyen 2020-10-27  64  		pr_err("unable to register device\n");
2e7fffa64d1ec2 Dinh Nguyen 2020-10-27  65  
2e7fffa64d1ec2 Dinh Nguyen 2020-10-27  66  	return 0;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  67  
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  68  err_alloc:
2e7fffa64d1ec2 Dinh Nguyen 2020-10-27  69  	release_mem_region(res.start, size);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  70  	kfree(data);
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  71  	return ret;
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  72  };
b3ca9888f35fa6 Dinh Nguyen 2018-11-13  73  

:::::: The code at line 35 was first introduced by commit
:::::: b3ca9888f35fa6919569cf27c929dc0ac49e9716 reset: socfpga: add an early reset driver for SoCFPGA

:::::: TO: Dinh Nguyen <dinguyen@kernel.org>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 48198 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-28  5:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28  5:24 [dinguyen:v5.10_socfpga_reset_fix 1/1] drivers/reset/reset-socfpga.c:35:6: warning: variable 'size' is used uninitialized whenever 'if' condition is true kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.