diff options
author | Chris Ball <cjb@laptop.org> | 2011-04-13 23:40:30 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-05-24 21:01:52 -0400 |
commit | 1278dba167f01bb3c6626d16450d31129d041087 (patch) | |
tree | 6fb3af716e5437cb558ae37fd8a58db23b9b173e /drivers/mmc/core/sdio_ops.c | |
parent | 62929e4be3fe4cc632b3b03645e083c6548de531 (diff) |
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/sdio_ops.c')
-rw-r--r-- | drivers/mmc/core/sdio_ops.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c index dea36d9c22e6..f77b1bc318ed 100644 --- a/drivers/mmc/core/sdio_ops.c +++ b/drivers/mmc/core/sdio_ops.c @@ -21,13 +21,11 @@ int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) { - struct mmc_command cmd; + struct mmc_command cmd = {0}; int i, err = 0; BUG_ON(!host); - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = SD_IO_SEND_OP_COND; cmd.arg = ocr; cmd.flags = MMC_RSP_SPI_R4 | MMC_RSP_R4 | MMC_CMD_BCR; @@ -70,7 +68,7 @@ int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn, unsigned addr, u8 in, u8 *out) { - struct mmc_command cmd; + struct mmc_command cmd = {0}; int err; BUG_ON(!host); @@ -80,8 +78,6 @@ static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn, if (addr & ~0x1FFFF) return -EINVAL; - memset(&cmd, 0, sizeof(struct mmc_command)); - cmd.opcode = SD_IO_RW_DIRECT; cmd.arg = write ? 0x80000000 : 0x00000000; cmd.arg |= fn << 28; @@ -126,7 +122,7 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz) { struct mmc_request mrq; - struct mmc_command cmd; + struct mmc_command cmd = {0}; struct mmc_data data; struct scatterlist sg; @@ -141,7 +137,6 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, return -EINVAL; memset(&mrq, 0, sizeof(struct mmc_request)); - memset(&cmd, 0, sizeof(struct mmc_command)); memset(&data, 0, sizeof(struct mmc_data)); mrq.cmd = &cmd; |