lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Sun, 30 Jan 2022 10:46:38 +0800
From:   kernel test robot <yujie.liu@...el.com>
To:     Anand Ashok Dumbre <anand.ashok.dumbre@...inx.com>
CC:     <llvm@...ts.linux.dev>, <kbuild-all@...ts.01.org>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Manish Narani <manish.narani@...inx.com>
Subject: drivers/iio/adc/xilinx-ams.c:1324:3: warning: Value stored to 'ret'
 is never read [clang-analyzer-deadcode.DeadStores]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   23a46422c56144939c091c76cf389aa863ce9c18
commit: d5c70627a79455154f5f636096abe6fe57510605 iio: adc: Add Xilinx AMS driver
date:   5 weeks ago
config: riscv-randconfig-c006-20220126 (https://download.01.org/0day-ci/archive/20220128/202201282049.dQhZXwBH-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2a1b7aa016c0f4b5598806205bdfbab1ea2d92c4)
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 riscv cross compiling tool for clang build
         # apt-get install binutils-riscv64-linux-gnu
         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d5c70627a79455154f5f636096abe6fe57510605
         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
         git fetch --no-tags linus master
         git checkout d5c70627a79455154f5f636096abe6fe57510605
         # save the config file to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@...el.com>


clang-analyzer warnings: (new ones prefixed by >>)

 >> drivers/iio/adc/xilinx-ams.c:1324:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                    ret = -ENOMEM;
                    ^     ~~~~~~~

vim +/ret +1324 drivers/iio/adc/xilinx-ams.c

d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1253
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1254  static int ams_parse_firmware(struct iio_dev *indio_dev)
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1255  {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1256  	struct ams *ams = iio_priv(indio_dev);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1257  	struct iio_chan_spec *ams_channels, *dev_channels;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1258  	struct device *dev = indio_dev->dev.parent;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1259  	struct fwnode_handle *child = NULL;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1260  	struct fwnode_handle *fwnode = dev_fwnode(dev);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1261  	size_t ams_size, dev_size;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1262  	int ret, ch_cnt = 0, i, rising_off, falling_off;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1263  	unsigned int num_channels = 0;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1264
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1265  	ams_size = ARRAY_SIZE(ams_ps_channels) + ARRAY_SIZE(ams_pl_channels) +
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1266  		ARRAY_SIZE(ams_ctrl_channels);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1267
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1268  	/* Initialize buffer for channel specification */
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1269  	ams_channels = devm_kcalloc(dev, ams_size, sizeof(*ams_channels), GFP_KERNEL);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1270  	if (!ams_channels)
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1271  		return -ENOMEM;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1272
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1273  	if (fwnode_device_is_available(fwnode)) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1274  		ret = ams_init_module(indio_dev, fwnode, ams_channels);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1275  		if (ret < 0)
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1276  			return ret;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1277
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1278  		num_channels += ret;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1279  	}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1280
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1281  	fwnode_for_each_child_node(fwnode, child) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1282  		if (fwnode_device_is_available(child)) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1283  			ret = ams_init_module(indio_dev, child, ams_channels + num_channels);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1284  			if (ret < 0) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1285  				fwnode_handle_put(child);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1286  				return ret;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1287  			}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1288
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1289  			num_channels += ret;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1290  		}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1291  	}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1292
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1293  	for (i = 0; i < num_channels; i++) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1294  		ams_channels[i].channel = ch_cnt++;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1295
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1296  		if (ams_channels[i].scan_index < AMS_CTRL_SEQ_BASE) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1297  			/* set threshold to max and min for each channel */
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1298  			falling_off =
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1299  				ams_get_alarm_offset(ams_channels[i].scan_index,
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1300  						     IIO_EV_DIR_FALLING);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1301  			rising_off =
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1302  				ams_get_alarm_offset(ams_channels[i].scan_index,
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1303  						     IIO_EV_DIR_RISING);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1304  			if (ams_channels[i].scan_index >= AMS_PS_SEQ_MAX) {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1305  				writel(AMS_ALARM_THR_MIN,
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1306  				       ams->pl_base + falling_off);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1307  				writel(AMS_ALARM_THR_MAX,
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1308  				       ams->pl_base + rising_off);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1309  			} else {
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1310  				writel(AMS_ALARM_THR_MIN,
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1311  				       ams->ps_base + falling_off);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1312  				writel(AMS_ALARM_THR_MAX,
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1313  				       ams->ps_base + rising_off);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1314  			}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1315  		}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1316  	}
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1317
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1318  	dev_size = array_size(sizeof(*dev_channels), num_channels);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1319  	if (dev_size == SIZE_MAX)
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1320  		return -ENOMEM;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1321
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1322  	dev_channels = devm_krealloc(dev, ams_channels, dev_size, GFP_KERNEL);
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1323  	if (!dev_channels)
d5c70627a79455 Anand Ashok Dumbre 2021-12-03 @1324  		ret = -ENOMEM;

'return -ENOMEM;' ?

d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1325
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1326  	indio_dev->channels = dev_channels;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1327  	indio_dev->num_channels = num_channels;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1328
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1329  	return 0;
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1330  }
d5c70627a79455 Anand Ashok Dumbre 2021-12-03  1331

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ