drivers/spi/spi-stm32-qspi.c:468:27: warning: 'op' is used uninitialized

From: kernel test robot
Date: Thu Jul 27 2023 - 21:16:46 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 57012c57536f8814dec92e74197ee96c3498d24e
commit: 68f5d3f3b6543266b29e047cfaf9842333019b4c um: add PCI over virtio emulation driver
date: 2 years, 1 month ago
config: um-allyesconfig (https://download.01.org/0day-ci/archive/20230728/202307280915.PELlO3TQ-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230728/202307280915.PELlO3TQ-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307280915.PELlO3TQ-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/spi/spi-stm32-qspi.c: In function 'stm32_qspi_dirmap_read':
>> drivers/spi/spi-stm32-qspi.c:468:27: warning: 'op' is used uninitialized [-Wuninitialized]
468 | struct spi_mem_op op;
| ^~
drivers/spi/spi-stm32-qspi.c:468:27: note: 'op' declared here
468 | struct spi_mem_op op;
| ^~


vim +/op +468 drivers/spi/spi-stm32-qspi.c

18674dee3cd651 Patrice Chotard 2021-04-19 463
18674dee3cd651 Patrice Chotard 2021-04-19 464 static ssize_t stm32_qspi_dirmap_read(struct spi_mem_dirmap_desc *desc,
18674dee3cd651 Patrice Chotard 2021-04-19 465 u64 offs, size_t len, void *buf)
18674dee3cd651 Patrice Chotard 2021-04-19 466 {
18674dee3cd651 Patrice Chotard 2021-04-19 467 struct stm32_qspi *qspi = spi_controller_get_devdata(desc->mem->spi->master);
18674dee3cd651 Patrice Chotard 2021-04-19 @468 struct spi_mem_op op;
18674dee3cd651 Patrice Chotard 2021-04-19 469 u32 addr_max;
18674dee3cd651 Patrice Chotard 2021-04-19 470 int ret;
18674dee3cd651 Patrice Chotard 2021-04-19 471
18674dee3cd651 Patrice Chotard 2021-04-19 472 ret = pm_runtime_get_sync(qspi->dev);
18674dee3cd651 Patrice Chotard 2021-04-19 473 if (ret < 0) {
18674dee3cd651 Patrice Chotard 2021-04-19 474 pm_runtime_put_noidle(qspi->dev);
18674dee3cd651 Patrice Chotard 2021-04-19 475 return ret;
18674dee3cd651 Patrice Chotard 2021-04-19 476 }
18674dee3cd651 Patrice Chotard 2021-04-19 477
18674dee3cd651 Patrice Chotard 2021-04-19 478 mutex_lock(&qspi->lock);
18674dee3cd651 Patrice Chotard 2021-04-19 479 /* make a local copy of desc op_tmpl and complete dirmap rdesc
18674dee3cd651 Patrice Chotard 2021-04-19 480 * spi_mem_op template with offs, len and *buf in order to get
18674dee3cd651 Patrice Chotard 2021-04-19 481 * all needed transfer information into struct spi_mem_op
18674dee3cd651 Patrice Chotard 2021-04-19 482 */
18674dee3cd651 Patrice Chotard 2021-04-19 483 memcpy(&op, &desc->info.op_tmpl, sizeof(struct spi_mem_op));
14ef64ebdc2a45 Arnd Bergmann 2021-04-22 484 dev_dbg(qspi->dev, "%s len = 0x%zx offs = 0x%llx buf = 0x%p\n", __func__, len, offs, buf);
18674dee3cd651 Patrice Chotard 2021-04-19 485
18674dee3cd651 Patrice Chotard 2021-04-19 486 op.data.nbytes = len;
18674dee3cd651 Patrice Chotard 2021-04-19 487 op.addr.val = desc->info.offset + offs;
18674dee3cd651 Patrice Chotard 2021-04-19 488 op.data.buf.in = buf;
18674dee3cd651 Patrice Chotard 2021-04-19 489
18674dee3cd651 Patrice Chotard 2021-04-19 490 addr_max = op.addr.val + op.data.nbytes + 1;
18674dee3cd651 Patrice Chotard 2021-04-19 491 if (addr_max < qspi->mm_size && op.addr.buswidth)
18674dee3cd651 Patrice Chotard 2021-04-19 492 qspi->fmode = CCR_FMODE_MM;
18674dee3cd651 Patrice Chotard 2021-04-19 493 else
18674dee3cd651 Patrice Chotard 2021-04-19 494 qspi->fmode = CCR_FMODE_INDR;
18674dee3cd651 Patrice Chotard 2021-04-19 495
18674dee3cd651 Patrice Chotard 2021-04-19 496 ret = stm32_qspi_send(desc->mem, &op);
18674dee3cd651 Patrice Chotard 2021-04-19 497 mutex_unlock(&qspi->lock);
18674dee3cd651 Patrice Chotard 2021-04-19 498
18674dee3cd651 Patrice Chotard 2021-04-19 499 pm_runtime_mark_last_busy(qspi->dev);
18674dee3cd651 Patrice Chotard 2021-04-19 500 pm_runtime_put_autosuspend(qspi->dev);
18674dee3cd651 Patrice Chotard 2021-04-19 501
18674dee3cd651 Patrice Chotard 2021-04-19 502 return ret ?: len;
18674dee3cd651 Patrice Chotard 2021-04-19 503 }
18674dee3cd651 Patrice Chotard 2021-04-19 504

:::::: The code at line 468 was first introduced by commit
:::::: 18674dee3cd651279eb3d9ba789fe483ddfe1137 spi: stm32-qspi: Add dirmap support

:::::: TO: Patrice Chotard <patrice.chotard@xxxxxxxxxxx>
:::::: CC: Mark Brown <broonie@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki