summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorChris Ball2011-04-14 05:40:30 +0200
committerChris Ball2011-05-25 03:01:52 +0200
commit1278dba167f01bb3c6626d16450d31129d041087 (patch)
tree6fb3af716e5437cb558ae37fd8a58db23b9b173e /drivers/mmc/core/core.c
parentmmc: card: Fix use of uninitialized data in mmc_blk_issue_rw_rq. (diff)
downloadkernel-qcow2-linux-1278dba167f01bb3c6626d16450d31129d041087.tar.gz
kernel-qcow2-linux-1278dba167f01bb3c6626d16450d31129d041087.tar.xz
kernel-qcow2-linux-1278dba167f01bb3c6626d16450d31129d041087.zip
mmc: initialize struct mmc_command at declaration time
Converts from: struct mmc_command cmd; memset(&cmd, 0, sizeof(struct mmc_command)); to: struct mmc_command cmd = {0}; because it's shorter, as performant, and easier to work out whether initialization has happened. Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5178d5daa5f4..f273ffd6557a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1286,7 +1286,7 @@ static unsigned int mmc_erase_timeout(struct mmc_card *card,
static int mmc_do_erase(struct mmc_card *card, unsigned int from,
unsigned int to, unsigned int arg)
{
- struct mmc_command cmd;
+ struct mmc_command cmd = {0};
unsigned int qty = 0;
int err;
@@ -1320,7 +1320,6 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from,
to <<= 9;
}
- memset(&cmd, 0, sizeof(struct mmc_command));
if (mmc_card_sd(card))
cmd.opcode = SD_ERASE_WR_BLK_START;
else
@@ -1490,12 +1489,11 @@ EXPORT_SYMBOL(mmc_erase_group_aligned);
int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
{
- struct mmc_command cmd;
+ struct mmc_command cmd = {0};
if (mmc_card_blockaddr(card) || mmc_card_ddr_mode(card))
return 0;
- memset(&cmd, 0, sizeof(struct mmc_command));
cmd.opcode = MMC_SET_BLOCKLEN;
cmd.arg = blocklen;
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;