aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/sd_ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/sd_ops.c')
-rw-r--r--drivers/mmc/core/sd_ops.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index da508497a6e..dfe9a9c3f95 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -24,13 +24,11 @@
24static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) 24static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
25{ 25{
26 int err; 26 int err;
27 struct mmc_command cmd; 27 struct mmc_command cmd = {0};
28 28
29 BUG_ON(!host); 29 BUG_ON(!host);
30 BUG_ON(card && (card->host != host)); 30 BUG_ON(card && (card->host != host));
31 31
32 memset(&cmd, 0, sizeof(struct mmc_command));
33
34 cmd.opcode = MMC_APP_CMD; 32 cmd.opcode = MMC_APP_CMD;
35 33
36 if (card) { 34 if (card) {
@@ -121,13 +119,11 @@ EXPORT_SYMBOL(mmc_wait_for_app_cmd);
121int mmc_app_set_bus_width(struct mmc_card *card, int width) 119int mmc_app_set_bus_width(struct mmc_card *card, int width)
122{ 120{
123 int err; 121 int err;
124 struct mmc_command cmd; 122 struct mmc_command cmd = {0};
125 123
126 BUG_ON(!card); 124 BUG_ON(!card);
127 BUG_ON(!card->host); 125 BUG_ON(!card->host);
128 126
129 memset(&cmd, 0, sizeof(struct mmc_command));
130
131 cmd.opcode = SD_APP_SET_BUS_WIDTH; 127 cmd.opcode = SD_APP_SET_BUS_WIDTH;
132 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; 128 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
133 129
@@ -151,13 +147,11 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width)
151 147
152int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) 148int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
153{ 149{
154 struct mmc_command cmd; 150 struct mmc_command cmd = {0};
155 int i, err = 0; 151 int i, err = 0;
156 152
157 BUG_ON(!host); 153 BUG_ON(!host);
158 154
159 memset(&cmd, 0, sizeof(struct mmc_command));
160
161 cmd.opcode = SD_APP_OP_COND; 155 cmd.opcode = SD_APP_OP_COND;
162 if (mmc_host_is_spi(host)) 156 if (mmc_host_is_spi(host))
163 cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */ 157 cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */
@@ -196,13 +190,11 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
196 190
197int mmc_send_if_cond(struct mmc_host *host, u32 ocr) 191int mmc_send_if_cond(struct mmc_host *host, u32 ocr)
198{ 192{
199 struct mmc_command cmd; 193 struct mmc_command cmd = {0};
200 int err; 194 int err;
201 static const u8 test_pattern = 0xAA; 195 static const u8 test_pattern = 0xAA;
202 u8 result_pattern; 196 u8 result_pattern;
203 197
204 memset(&cmd, 0, sizeof(struct mmc_command));
205
206 /* 198 /*
207 * To support SD 2.0 cards, we must always invoke SD_SEND_IF_COND 199 * To support SD 2.0 cards, we must always invoke SD_SEND_IF_COND
208 * before SD_APP_OP_COND. This command will harmlessly fail for 200 * before SD_APP_OP_COND. This command will harmlessly fail for
@@ -230,13 +222,11 @@ int mmc_send_if_cond(struct mmc_host *host, u32 ocr)
230int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca) 222int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
231{ 223{
232 int err; 224 int err;
233 struct mmc_command cmd; 225 struct mmc_command cmd = {0};
234 226
235 BUG_ON(!host); 227 BUG_ON(!host);
236 BUG_ON(!rca); 228 BUG_ON(!rca);
237 229
238 memset(&cmd, 0, sizeof(struct mmc_command));
239
240 cmd.opcode = SD_SEND_RELATIVE_ADDR; 230 cmd.opcode = SD_SEND_RELATIVE_ADDR;
241 cmd.arg = 0; 231 cmd.arg = 0;
242 cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR; 232 cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR;
@@ -254,7 +244,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
254{ 244{
255 int err; 245 int err;
256 struct mmc_request mrq; 246 struct mmc_request mrq;
257 struct mmc_command cmd; 247 struct mmc_command cmd = {0};
258 struct mmc_data data; 248 struct mmc_data data;
259 struct scatterlist sg; 249 struct scatterlist sg;
260 void *data_buf; 250 void *data_buf;
@@ -277,7 +267,6 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
277 return -ENOMEM; 267 return -ENOMEM;
278 268
279 memset(&mrq, 0, sizeof(struct mmc_request)); 269 memset(&mrq, 0, sizeof(struct mmc_request));
280 memset(&cmd, 0, sizeof(struct mmc_command));
281 memset(&data, 0, sizeof(struct mmc_data)); 270 memset(&data, 0, sizeof(struct mmc_data));
282 271
283 mrq.cmd = &cmd; 272 mrq.cmd = &cmd;
@@ -317,7 +306,7 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
317 u8 value, u8 *resp) 306 u8 value, u8 *resp)
318{ 307{
319 struct mmc_request mrq; 308 struct mmc_request mrq;
320 struct mmc_command cmd; 309 struct mmc_command cmd = {0};
321 struct mmc_data data; 310 struct mmc_data data;
322 struct scatterlist sg; 311 struct scatterlist sg;
323 312
@@ -330,7 +319,6 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
330 value &= 0xF; 319 value &= 0xF;
331 320
332 memset(&mrq, 0, sizeof(struct mmc_request)); 321 memset(&mrq, 0, sizeof(struct mmc_request));
333 memset(&cmd, 0, sizeof(struct mmc_command));
334 memset(&data, 0, sizeof(struct mmc_data)); 322 memset(&data, 0, sizeof(struct mmc_data));
335 323
336 mrq.cmd = &cmd; 324 mrq.cmd = &cmd;
@@ -366,7 +354,7 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)
366{ 354{
367 int err; 355 int err;
368 struct mmc_request mrq; 356 struct mmc_request mrq;
369 struct mmc_command cmd; 357 struct mmc_command cmd = {0};
370 struct mmc_data data; 358 struct mmc_data data;
371 struct scatterlist sg; 359 struct scatterlist sg;
372 360
@@ -381,7 +369,6 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)
381 return err; 369 return err;
382 370
383 memset(&mrq, 0, sizeof(struct mmc_request)); 371 memset(&mrq, 0, sizeof(struct mmc_request));
384 memset(&cmd, 0, sizeof(struct mmc_command));
385 memset(&data, 0, sizeof(struct mmc_data)); 372 memset(&data, 0, sizeof(struct mmc_data));
386 373
387 mrq.cmd = &cmd; 374 mrq.cmd = &cmd;