All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: linus.walleij@linaro.org
Cc: linux-mmc@vger.kernel.org
Subject: [bug report] mmc: block: return errorcode from mmc_sd_num_wr_blocks()
Date: Tue, 7 Feb 2017 11:23:16 +0300	[thread overview]
Message-ID: <20170207082316.GA25804@mwanda> (raw)

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

             reply	other threads:[~2017-02-07  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07  8:23 Dan Carpenter [this message]
2017-02-13 14:41 ` [bug report] mmc: block: return errorcode from mmc_sd_num_wr_blocks() Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170207082316.GA25804@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.