Re: [PATCH v2 13/23] counter: Provide alternative counter registration functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi "Uwe,

url:    https://github.com/0day-ci/linux/commits/Uwe-Kleine-K-nig/counter-cleanups-and-device-lifetime-fixes/20211227-174815
base:   a7904a538933c525096ca2ccde1e60d0ee62c08e
config: i386-randconfig-m021-20211227 (https://download.01.org/0day-ci/archive/20211229/202112290340.PMwi47LV-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/counter/counter-core.c:175 counter_alloc() error: uninitialized symbol 'id'.

vim +/id +175 drivers/counter/counter-core.c

250e0e3d91caea Uwe Kleine-König       2021-12-27  144  struct counter_device *counter_alloc(size_t sizeof_priv)
250e0e3d91caea Uwe Kleine-König       2021-12-27  145  {
250e0e3d91caea Uwe Kleine-König       2021-12-27  146  	struct counter_device_allochelper *ch;
250e0e3d91caea Uwe Kleine-König       2021-12-27  147  	struct counter_device *counter;
250e0e3d91caea Uwe Kleine-König       2021-12-27  148  	struct device *dev;
250e0e3d91caea Uwe Kleine-König       2021-12-27  149  	int id, err;
250e0e3d91caea Uwe Kleine-König       2021-12-27  150  
250e0e3d91caea Uwe Kleine-König       2021-12-27  151  	ch = kzalloc(sizeof(*ch) + sizeof_priv, GFP_KERNEL);
250e0e3d91caea Uwe Kleine-König       2021-12-27  152  	if (!ch) {
250e0e3d91caea Uwe Kleine-König       2021-12-27  153  		err = -ENOMEM;
250e0e3d91caea Uwe Kleine-König       2021-12-27  154  		goto err_alloc_ch;
250e0e3d91caea Uwe Kleine-König       2021-12-27  155  	}
250e0e3d91caea Uwe Kleine-König       2021-12-27  156  
250e0e3d91caea Uwe Kleine-König       2021-12-27  157  	counter = &ch->counter;
250e0e3d91caea Uwe Kleine-König       2021-12-27  158  	dev = &counter->dev;
250e0e3d91caea Uwe Kleine-König       2021-12-27  159  
250e0e3d91caea Uwe Kleine-König       2021-12-27  160  	/* Acquire unique ID */
250e0e3d91caea Uwe Kleine-König       2021-12-27  161  	err = ida_alloc(&counter_ida, GFP_KERNEL);
250e0e3d91caea Uwe Kleine-König       2021-12-27  162  	if (err < 0) {
250e0e3d91caea Uwe Kleine-König       2021-12-27  163  		goto err_ida_alloc;
250e0e3d91caea Uwe Kleine-König       2021-12-27  164  	}
250e0e3d91caea Uwe Kleine-König       2021-12-27  165  	dev->id = err;
250e0e3d91caea Uwe Kleine-König       2021-12-27  166  
250e0e3d91caea Uwe Kleine-König       2021-12-27  167  	err = counter_chrdev_add(counter);
250e0e3d91caea Uwe Kleine-König       2021-12-27  168  	if (err < 0)
250e0e3d91caea Uwe Kleine-König       2021-12-27  169  		goto err_chrdev_add;
250e0e3d91caea Uwe Kleine-König       2021-12-27  170  
250e0e3d91caea Uwe Kleine-König       2021-12-27  171  	device_initialize(dev);
250e0e3d91caea Uwe Kleine-König       2021-12-27  172  	/* Configure device structure for Counter */
250e0e3d91caea Uwe Kleine-König       2021-12-27  173  	dev->type = &counter_device_type;
250e0e3d91caea Uwe Kleine-König       2021-12-27  174  	dev->bus = &counter_bus_type;
250e0e3d91caea Uwe Kleine-König       2021-12-27 @175  	dev->devt = MKDEV(MAJOR(counter_devt), id);

"id" is uninitialized.  Should this be "dev->id"?

250e0e3d91caea Uwe Kleine-König       2021-12-27  176  
250e0e3d91caea Uwe Kleine-König       2021-12-27  177  	mutex_init(&counter->ops_exist_lock);
250e0e3d91caea Uwe Kleine-König       2021-12-27  178  
250e0e3d91caea Uwe Kleine-König       2021-12-27  179  	return counter;
250e0e3d91caea Uwe Kleine-König       2021-12-27  180  
250e0e3d91caea Uwe Kleine-König       2021-12-27  181  err_chrdev_add:
250e0e3d91caea Uwe Kleine-König       2021-12-27  182  
250e0e3d91caea Uwe Kleine-König       2021-12-27  183  	ida_free(&counter_ida, dev->id);
250e0e3d91caea Uwe Kleine-König       2021-12-27  184  err_ida_alloc:
250e0e3d91caea Uwe Kleine-König       2021-12-27  185  
250e0e3d91caea Uwe Kleine-König       2021-12-27  186  	kfree(ch);
250e0e3d91caea Uwe Kleine-König       2021-12-27  187  err_alloc_ch:
250e0e3d91caea Uwe Kleine-König       2021-12-27  188  
250e0e3d91caea Uwe Kleine-König       2021-12-27  189  	return ERR_PTR(err);
250e0e3d91caea Uwe Kleine-König       2021-12-27  190  }

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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux