diff options
Diffstat (limited to 'drivers/mmc/card/block.c')
-rw-r--r-- | drivers/mmc/card/block.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 98ffc41eaf2c..adc205c49fbf 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -147,7 +147,8 @@ struct mmc_blk_request { | |||
147 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | 147 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) |
148 | { | 148 | { |
149 | int err; | 149 | int err; |
150 | __be32 blocks; | 150 | u32 result; |
151 | __be32 *blocks; | ||
151 | 152 | ||
152 | struct mmc_request mrq; | 153 | struct mmc_request mrq; |
153 | struct mmc_command cmd; | 154 | struct mmc_command cmd; |
@@ -199,14 +200,21 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
199 | mrq.cmd = &cmd; | 200 | mrq.cmd = &cmd; |
200 | mrq.data = &data; | 201 | mrq.data = &data; |
201 | 202 | ||
202 | sg_init_one(&sg, &blocks, 4); | 203 | blocks = kmalloc(4, GFP_KERNEL); |
204 | if (!blocks) | ||
205 | return (u32)-1; | ||
206 | |||
207 | sg_init_one(&sg, blocks, 4); | ||
203 | 208 | ||
204 | mmc_wait_for_req(card->host, &mrq); | 209 | mmc_wait_for_req(card->host, &mrq); |
205 | 210 | ||
211 | result = ntohl(*blocks); | ||
212 | kfree(blocks); | ||
213 | |||
206 | if (cmd.error || data.error) | 214 | if (cmd.error || data.error) |
207 | return (u32)-1; | 215 | result = (u32)-1; |
208 | 216 | ||
209 | return ntohl(blocks); | 217 | return result; |
210 | } | 218 | } |
211 | 219 | ||
212 | static u32 get_card_status(struct mmc_card *card, struct request *req) | 220 | static u32 get_card_status(struct mmc_card *card, struct request *req) |