Re: [mtd:spi-mem-ecc 14/16] drivers/mtd/nand/ecc-mxic.c:395 mxic_ecc_data_xfer_wait_for_completion() error: uninitialized symbol 'val'.

From: Miquel Raynal
Date: Wed Jan 26 2022 - 05:49:56 EST


Hi Dan,

dan.carpenter@xxxxxxxxxx wrote on Thu, 6 Jan 2022 11:54:51 +0300:

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-mem-ecc
> head: 5966bd4f59edbbe5873b1b4637ed50f258ced0b2
> commit: b78baf1891f0b7c3f0e2e3e6022eab38ee6c871f [14/16] mtd: nand: mxic-ecc: Add Macronix external ECC engine support
> config: i386-randconfig-m021-20211227 (https://download.01.org/0day-ci/archive/20211227/202112271621.cNxEVvN6-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/mtd/nand/ecc-mxic.c:395 mxic_ecc_data_xfer_wait_for_completion() error: uninitialized symbol 'val'.
> drivers/mtd/nand/ecc-mxic.c:548 mxic_ecc_prepare_io_req_external() error: uninitialized symbol 'ret'.
>
> vim +/val +395 drivers/mtd/nand/ecc-mxic.c
>
> b78baf1891f0b7 Miquel Raynal 2021-12-16 377 static int mxic_ecc_data_xfer_wait_for_completion(struct mxic_ecc_engine *mxic)
> b78baf1891f0b7 Miquel Raynal 2021-12-16 378 {
> b78baf1891f0b7 Miquel Raynal 2021-12-16 379 u32 val;
> b78baf1891f0b7 Miquel Raynal 2021-12-16 380 int ret;
> b78baf1891f0b7 Miquel Raynal 2021-12-16 381
> b78baf1891f0b7 Miquel Raynal 2021-12-16 382 if (mxic->irq) {
> b78baf1891f0b7 Miquel Raynal 2021-12-16 383 reinit_completion(&mxic->complete);
> b78baf1891f0b7 Miquel Raynal 2021-12-16 384 mxic_ecc_enable_int(mxic);
> b78baf1891f0b7 Miquel Raynal 2021-12-16 385 ret = wait_for_completion_timeout(&mxic->complete,
> b78baf1891f0b7 Miquel Raynal 2021-12-16 386 msecs_to_jiffies(1000));
> b78baf1891f0b7 Miquel Raynal 2021-12-16 387 mxic_ecc_disable_int(mxic);
>
> "val" not set on this path.

Thanks for the report, I've fixed that inline.

> b78baf1891f0b7 Miquel Raynal 2021-12-16 388 } else {
> b78baf1891f0b7 Miquel Raynal 2021-12-16 389 ret = readl_poll_timeout(mxic->regs + INTRPT_STS, val,
> b78baf1891f0b7 Miquel Raynal 2021-12-16 390 val & TRANS_CMPLT, 10, USEC_PER_SEC);
> b78baf1891f0b7 Miquel Raynal 2021-12-16 391 writel(val, mxic->regs + INTRPT_STS);
> b78baf1891f0b7 Miquel Raynal 2021-12-16 392 }
> b78baf1891f0b7 Miquel Raynal 2021-12-16 393
> b78baf1891f0b7 Miquel Raynal 2021-12-16 394 if (ret) {
> b78baf1891f0b7 Miquel Raynal 2021-12-16 @395 dev_err(mxic->dev, "Timeout on data xfer completion (sts 0x%08x)\n", val);
> ^^^
>
> b78baf1891f0b7 Miquel Raynal 2021-12-16 396 return -ETIMEDOUT;
> b78baf1891f0b7 Miquel Raynal 2021-12-16 397 }
> b78baf1891f0b7 Miquel Raynal 2021-12-16 398
> b78baf1891f0b7 Miquel Raynal 2021-12-16 399 return 0;
> b78baf1891f0b7 Miquel Raynal 2021-12-16 400 }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
>


Thanks,
Miquèl