Re: [mtd:spi-mem-ecc 16/29] drivers/mtd/nand/ecc-mxic.c:652 mxic_ecc_finish_io_req_external() error: uninitialized symbol 'ret'.

From: Miquel Raynal
Date: Thu Feb 10 2022 - 03:34:08 EST


Hi Dan,

dan.carpenter@xxxxxxxxxx wrote on Wed, 9 Feb 2022 20:58:57 +0300:

> tree: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-mem-ecc
> head: b556a86810e25b9d5a56da553bc65e5f4dcbedb6
> commit: f46b431b115d2ead7ccf71da53a5d1993f0acfcd [16/29] mtd: nand: mxic-ecc: Support SPI pipelined mode
> config: arm64-randconfig-m031-20220209 (https://download.01.org/0day-ci/archive/20220210/202202100023.AD5wMMvp-lkp@xxxxxxxxx/config)
> compiler: aarch64-linux-gcc (GCC) 11.2.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>
>
> vim +/ret +652 drivers/mtd/nand/ecc-mxic.c
>
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 611 static int mxic_ecc_finish_io_req_external(struct nand_device *nand,
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 612 struct nand_page_io_req *req)
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 613 {
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 614 struct mxic_ecc_engine *mxic = nand_to_mxic(nand);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 615 struct mxic_ecc_ctx *ctx = nand_to_ecc_ctx(nand);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 616 int nents, step, ret;
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 617
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 618 if (req->mode == MTD_OPS_RAW)
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 619 return 0;
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 620
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 621 if (req->type == NAND_PAGE_WRITE) {
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 622 nand_ecc_restore_req(&ctx->req_ctx, req);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 623 return 0;
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 624 }
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 625
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 626 /* Copy the OOB buffer and add room for the ECC engine status bytes */
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 627 mxic_ecc_add_room_in_oobbuf(ctx, ctx->oobwithstat, ctx->req->oobbuf.in);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 628
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 629 sg_set_buf(&ctx->sg[0], req->databuf.in, req->datalen);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 630 sg_set_buf(&ctx->sg[1], ctx->oobwithstat,
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 631 req->ooblen + (ctx->steps * STAT_BYTES));
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 632 nents = dma_map_sg(mxic->dev, ctx->sg, 2, DMA_BIDIRECTIONAL);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 633 if (!nents)
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 634 return -EINVAL;
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 635
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 636 mutex_lock(&mxic->lock);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 637
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 638 for (step = 0; step < ctx->steps; step++) {
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 639 writel(sg_dma_address(&ctx->sg[0]) + (step * ctx->data_step_sz),
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 640 mxic->regs + SDMA_MAIN_ADDR);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 641 writel(sg_dma_address(&ctx->sg[1]) + (step * (ctx->oob_step_sz + STAT_BYTES)),
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 642 mxic->regs + SDMA_SPARE_ADDR);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 643 ret = mxic_ecc_process_data(mxic, ctx->req->type);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 644 if (ret)
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 645 break;
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 646 }
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 647
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 648 mutex_unlock(&mxic->lock);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 649
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 650 dma_unmap_sg(mxic->dev, ctx->sg, 2, DMA_BIDIRECTIONAL);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 651
> f46b431b115d2ea Miquel Raynal 2021-12-16 @652 if (!ret) {
>
> Hi Miquel,
>
> This if statement is reversed. No !

-___-

I've attempted to do something else, and finally got rid of it, but
left the '!' behind...

> f46b431b115d2ea Miquel Raynal 2021-12-16 653 nand_ecc_restore_req(&ctx->req_ctx, req);
> f46b431b115d2ea Miquel Raynal 2021-12-16 654 return ret;
> f46b431b115d2ea Miquel Raynal 2021-12-16 655 }
> f46b431b115d2ea Miquel Raynal 2021-12-16 656
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 657 /* Extract the status bytes and reconstruct the buffer */
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 658 mxic_ecc_extract_status_bytes(ctx);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 659 mxic_ecc_reconstruct_oobbuf(ctx, ctx->req->oobbuf.in, ctx->oobwithstat);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 660
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 661 nand_ecc_restore_req(&ctx->req_ctx, req);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 662
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 663 return mxic_ecc_count_biterrs(mxic, nand);
> 48e6633a9fa2400 Miquel Raynal 2021-12-16 664 }
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
>


Thanks,
Miquèl