* [bug report] mmc: block: return errorcode from mmc_sd_num_wr_blocks()
@ 2017-02-07 8:23 Dan Carpenter
2017-02-13 14:41 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-02-07 8:23 UTC (permalink / raw)
To: linus.walleij; +Cc: linux-mmc
Hello Linus Walleij,
The patch 9a5e7ddc7954: "mmc: block: return errorcode from
mmc_sd_num_wr_blocks()" from Feb 1, 2017, leads to the following
static checker warning:
drivers/mmc/core/block.c:1589 mmc_blk_rw_cmd_err()
error: uninitialized symbol 'blocks'.
drivers/mmc/core/block.c
766 static int mmc_sd_num_wr_blocks(struct mmc_card *card, u32 *written_blocks)
767 {
768 int err;
769 u32 result;
770 __be32 *blocks;
771
772 struct mmc_request mrq = {};
773 struct mmc_command cmd = {};
774 struct mmc_data data = {};
775
776 struct scatterlist sg;
777
778 cmd.opcode = MMC_APP_CMD;
779 cmd.arg = card->rca << 16;
780 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
781
782 err = mmc_wait_for_cmd(card->host, &cmd, 0);
783 if (err)
784 return err;
785 if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
786 return 0;
This is supposed to be "return -EIO", I suspect. The caller expects
that *written_blocks is initialized if we return zero.
787
788 memset(&cmd, 0, sizeof(struct mmc_command));
789
790 cmd.opcode = SD_APP_SEND_NUM_WR_BLKS;
791 cmd.arg = 0;
792 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
793
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] mmc: block: return errorcode from mmc_sd_num_wr_blocks()
2017-02-07 8:23 [bug report] mmc: block: return errorcode from mmc_sd_num_wr_blocks() Dan Carpenter
@ 2017-02-13 14:41 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2017-02-13 14:41 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-mmc@vger.kernel.org
On Tue, Feb 7, 2017 at 9:23 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 785 if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD))
> 786 return 0;
>
> This is supposed to be "return -EIO", I suspect. The caller expects
> that *written_blocks is initialized if we return zero.
Indeed. I sent a fixup patch.
Thank you so much for noticing this and reporting!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-13 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 8:23 [bug report] mmc: block: return errorcode from mmc_sd_num_wr_blocks() Dan Carpenter
2017-02-13 14:41 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox