summaryrefslogtreecommitdiff
path: root/drivers/mmc/card
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2011-04-13 23:46:05 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 21:01:56 -0400
commita61ad2b49bfce94dfddce828cd9222e4b9e7825b (patch)
tree36f93e61adc7c7d7523c78c78c3df1e75fae5e33 /drivers/mmc/card
parent1278dba167f01bb3c6626d16450d31129d041087 (diff)
mmc: initialize struct mmc_data at declaration time
Converts from: struct mmc_data data; memset(&data, 0, sizeof(struct mmc_data)); to: struct mmc_data data = {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/card')
-rw-r--r--drivers/mmc/card/block.c4
-rw-r--r--drivers/mmc/card/mmc_test.c9
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 93a7efcbfde9..fb387c803205 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -261,7 +261,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
struct mmc_request mrq;
struct mmc_command cmd = {0};
- struct mmc_data data;
+ struct mmc_data data = {0};
unsigned int timeout_us;
struct scatterlist sg;
@@ -282,8 +282,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
cmd.arg = 0;
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
- memset(&data, 0, sizeof(struct mmc_data));
-
data.timeout_ns = card->csd.tacc_ns * 100;
data.timeout_clks = card->csd.tacc_clks * 100;
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 95c298faeb48..f44762b6e592 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -249,12 +249,11 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test,
struct mmc_request mrq;
struct mmc_command cmd = {0};
struct mmc_command stop = {0};
- struct mmc_data data;
+ struct mmc_data data = {0};
struct scatterlist sg;
memset(&mrq, 0, sizeof(struct mmc_request));
- memset(&data, 0, sizeof(struct mmc_data));
mrq.cmd = &cmd;
mrq.data = &data;
@@ -732,10 +731,9 @@ static int mmc_test_simple_transfer(struct mmc_test_card *test,
struct mmc_request mrq;
struct mmc_command cmd = {0};
struct mmc_command stop = {0};
- struct mmc_data data;
+ struct mmc_data data = {0};
memset(&mrq, 0, sizeof(struct mmc_request));
- memset(&data, 0, sizeof(struct mmc_data));
mrq.cmd = &cmd;
mrq.data = &data;
@@ -760,12 +758,11 @@ static int mmc_test_broken_transfer(struct mmc_test_card *test,
struct mmc_request mrq;
struct mmc_command cmd = {0};
struct mmc_command stop = {0};
- struct mmc_data data;
+ struct mmc_data data = {0};
struct scatterlist sg;
memset(&mrq, 0, sizeof(struct mmc_request));
- memset(&data, 0, sizeof(struct mmc_data));
mrq.cmd = &cmd;
mrq.data = &data;