aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/sd_ops.c
diff options
context:
space:
mode:
authorWinkler, Tomas <tomas.winkler@intel.com>2017-04-02 16:56:03 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-04-24 15:42:19 -0400
commit06c9ccb78e68e2e9b69e736fc0a39fb13be49b74 (patch)
tree11c6f82e92001c969de874e0259085b8add92160 /drivers/mmc/core/sd_ops.c
parent861183f115cd80db7efebf5516f4e7a424c13abd (diff)
mmc: core: add proper be32 annotation
Annotate big endian values correctly and make sparse happy. In mmc_app_send_scr remove scr function parameter as it was updating card->raw_scr anyway. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/sd_ops.c')
-rw-r--r--drivers/mmc/core/sd_ops.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
index 9d5824a37586..47056d8d1bac 100644
--- a/drivers/mmc/core/sd_ops.c
+++ b/drivers/mmc/core/sd_ops.c
@@ -232,14 +232,14 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
232 return 0; 232 return 0;
233} 233}
234 234
235int mmc_app_send_scr(struct mmc_card *card, u32 *scr) 235int mmc_app_send_scr(struct mmc_card *card)
236{ 236{
237 int err; 237 int err;
238 struct mmc_request mrq = {}; 238 struct mmc_request mrq = {};
239 struct mmc_command cmd = {}; 239 struct mmc_command cmd = {};
240 struct mmc_data data = {}; 240 struct mmc_data data = {};
241 struct scatterlist sg; 241 struct scatterlist sg;
242 void *data_buf; 242 __be32 *scr;
243 243
244 /* NOTE: caller guarantees scr is heap-allocated */ 244 /* NOTE: caller guarantees scr is heap-allocated */
245 245
@@ -250,8 +250,8 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
250 /* dma onto stack is unsafe/nonportable, but callers to this 250 /* dma onto stack is unsafe/nonportable, but callers to this
251 * routine normally provide temporary on-stack buffers ... 251 * routine normally provide temporary on-stack buffers ...
252 */ 252 */
253 data_buf = kmalloc(sizeof(card->raw_scr), GFP_KERNEL); 253 scr = kmalloc(sizeof(card->raw_scr), GFP_KERNEL);
254 if (data_buf == NULL) 254 if (!scr)
255 return -ENOMEM; 255 return -ENOMEM;
256 256
257 mrq.cmd = &cmd; 257 mrq.cmd = &cmd;
@@ -267,23 +267,22 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
267 data.sg = &sg; 267 data.sg = &sg;
268 data.sg_len = 1; 268 data.sg_len = 1;
269 269
270 sg_init_one(&sg, data_buf, 8); 270 sg_init_one(&sg, scr, 8);
271 271
272 mmc_set_data_timeout(&data, card); 272 mmc_set_data_timeout(&data, card);
273 273
274 mmc_wait_for_req(card->host, &mrq); 274 mmc_wait_for_req(card->host, &mrq);
275 275
276 memcpy(scr, data_buf, sizeof(card->raw_scr)); 276 card->raw_scr[0] = be32_to_cpu(scr[0]);
277 kfree(data_buf); 277 card->raw_scr[1] = be32_to_cpu(scr[1]);
278
279 kfree(scr);
278 280
279 if (cmd.error) 281 if (cmd.error)
280 return cmd.error; 282 return cmd.error;
281 if (data.error) 283 if (data.error)
282 return data.error; 284 return data.error;
283 285
284 scr[0] = be32_to_cpu(scr[0]);
285 scr[1] = be32_to_cpu(scr[1]);
286
287 return 0; 286 return 0;
288} 287}
289 288