drivers/dma/qcom/gpi.c:1254:15: warning: iteration 2 invokes undefined behavior

From: kernel test robot
Date: Fri Jan 01 2021 - 19:57:41 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eda809aef53426d044b519405d25d9da55319b76
commit: 5d0c3533a19f48e5e7e73806a3e4b29cd4364130 dmaengine: qcom: Add GPI dma driver
date: 5 weeks ago
config: arm64-randconfig-p002-20210102 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
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
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5d0c3533a19f48e5e7e73806a3e4b29cd4364130
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 5d0c3533a19f48e5e7e73806a3e4b29cd4364130
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64

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

All warnings (new ones prefixed by >>):

drivers/dma/qcom/gpi.c: In function 'gpi_alloc_chan_resources':
>> drivers/dma/qcom/gpi.c:1254:15: warning: iteration 2 invokes undefined behavior [-Waggressive-loop-optimizations]
1254 | struct gpii *gpii = gchan->gpii;
| ^~~~
drivers/dma/qcom/gpi.c:1951:2: note: within this loop
1951 | for (i = i - 1; i >= 0; i++) {
| ^~~


vim +1254 drivers/dma/qcom/gpi.c

1251
1252 static int gpi_stop_chan(struct gchan *gchan)
1253 {
> 1254 struct gpii *gpii = gchan->gpii;
1255 int ret;
1256
1257 ret = gpi_send_cmd(gpii, gchan, GPI_CH_CMD_STOP);
1258 if (ret) {
1259 dev_err(gpii->gpi_dev->dev, "Error with cmd:%s ret:%d\n",
1260 TO_GPI_CMD_STR(GPI_CH_CMD_STOP), ret);
1261 return ret;
1262 }
1263
1264 return 0;
1265 }
1266

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

Attachment: .config.gz
Description: application/gzip