Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243415
b: refs/heads/master
c: 4f665cb
h: refs/heads/master
i:
  243413: 6bb39a0
  243411: dab7232
  243407: d1901be
v: v3
  • Loading branch information
Yoshihiro Shimoda authored and Chris Ball committed Mar 25, 2011
1 parent 813520b commit bc74b5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58ac8177cebb890ba980cdace36457e0fe1e62af
refs/heads/master: 4f665cb614b8a258b507cc47753dd3f7dd45aac6
14 changes: 13 additions & 1 deletion trunk/drivers/mmc/core/sd_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* your option) any later version.
*/

#include <linux/slab.h>
#include <linux/types.h>
#include <linux/scatterlist.h>

Expand Down Expand Up @@ -252,6 +253,7 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
struct mmc_command cmd;
struct mmc_data data;
struct scatterlist sg;
void *data_buf;

BUG_ON(!card);
BUG_ON(!card->host);
Expand All @@ -263,6 +265,13 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
if (err)
return err;

/* dma onto stack is unsafe/nonportable, but callers to this
* routine normally provide temporary on-stack buffers ...
*/
data_buf = kmalloc(sizeof(card->raw_scr), GFP_KERNEL);
if (data_buf == NULL)
return -ENOMEM;

memset(&mrq, 0, sizeof(struct mmc_request));
memset(&cmd, 0, sizeof(struct mmc_command));
memset(&data, 0, sizeof(struct mmc_data));
Expand All @@ -280,12 +289,15 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
data.sg = &sg;
data.sg_len = 1;

sg_init_one(&sg, scr, 8);
sg_init_one(&sg, data_buf, 8);

mmc_set_data_timeout(&data, card);

mmc_wait_for_req(card->host, &mrq);

memcpy(scr, data_buf, sizeof(card->raw_scr));
kfree(data_buf);

if (cmd.error)
return cmd.error;
if (data.error)
Expand Down

0 comments on commit bc74b5f

Please sign in to comment.