[kbuild] Re: [PATCH v2 11/12][RESEND] iio: buffer: introduce support for attaching more IIO buffers

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

 



Hi Alexandru,

I love your patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/iio-core-buffer-add-support-for-multiple-IIO-buffers-per-IIO-device/20210125-053419
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git  togreg
config: i386-randconfig-m021-20210125 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-20) 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/iio/industrialio-buffer.c:1606 iio_buffer_alloc_sysfs_and_mask() error: uninitialized symbol 'cnt'.

vim +/cnt +1606 drivers/iio/industrialio-buffer.c

e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1562  int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
d967cb6bd4e79c0c Lars-Peter Clausen 2014-11-26  1563  {
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1564  	struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
ff3f7e049aef9202 Alexandru Ardelean 2020-04-24  1565  	struct iio_buffer *buffer = indio_dev->buffer;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1566  	const struct iio_chan_spec *channels;
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1567  	int i, cnt, ret;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1568  
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1569  	channels = indio_dev->channels;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1570  	if (channels) {
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1571  		int ml = indio_dev->masklength;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1572  
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1573  		for (i = 0; i < indio_dev->num_channels; i++)
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1574  			ml = max(ml, channels[i].scan_index + 1);
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1575  		indio_dev->masklength = ml;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1576  	}
ff3f7e049aef9202 Alexandru Ardelean 2020-04-24  1577  
ff3f7e049aef9202 Alexandru Ardelean 2020-04-24  1578  	if (!buffer)
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1579  		return 0;
e16e0a778fec8ac1 Alexandru Ardelean 2020-09-17  1580  
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1581  	for (i = 0; i < iio_dev_opaque->attached_buffers_cnt; i++) {
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1582  		buffer = iio_dev_opaque->attached_buffers[i];
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1583  		ret = __iio_buffer_alloc_sysfs_and_mask(buffer, indio_dev, i);
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1584  		if (ret)
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1585  			goto error_unwind_sysfs_and_mask;

"cnt" is not set here.

8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1586  	}
d967cb6bd4e79c0c Lars-Peter Clausen 2014-11-26  1587  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1588  	ret = sysfs_create_link(&indio_dev->dev.kobj,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1589  				&indio_dev->buffer->buffer_dir,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1590  				"buffer");
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1591  	if (ret)
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1592  		goto error_unwind_sysfs_and_mask;

Oh here.

e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1593  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1594  	ret = sysfs_create_link(&indio_dev->dev.kobj,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1595  				&indio_dev->buffer->scan_el_dir,
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1596  				"scan_elements");
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1597  	if (ret)
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1598  		goto error_remove_buffer_dir_link;
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1599  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1600  	return 0;
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1601  
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1602  error_remove_buffer_dir_link:
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1603  	sysfs_remove_link(&indio_dev->dev.kobj, "buffer");
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1604  	cnt = iio_dev_opaque->attached_buffers_cnt - 1;
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1605  error_unwind_sysfs_and_mask:
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22 @1606  	for (; cnt >= 0; cnt--) {
                                                               ^^^^^^^^
Uninitialized.

8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1607  		buffer = iio_dev_opaque->attached_buffers[cnt];
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1608  		__iio_buffer_free_sysfs_and_mask(buffer);
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1609  	}
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1610  	kfree(iio_dev_opaque->attached_buffers);
8b70c93a9d04de1e Alexandru Ardelean 2021-01-22  1611  	iio_dev_opaque->attached_buffers = NULL;
e2eb176de4748db8 Alexandru Ardelean 2021-01-22  1612  	return ret;
d967cb6bd4e79c0c Lars-Peter Clausen 2014-11-26  1613  }

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@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