diff options
Diffstat (limited to 'drivers/mmc/card/queue.c')
-rw-r--r-- | drivers/mmc/card/queue.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index c9a289c6c139..b0abc7d92805 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -117,7 +117,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
117 | struct mmc_host *host = card->host; | 117 | struct mmc_host *host = card->host; |
118 | u64 limit = BLK_BOUNCE_HIGH; | 118 | u64 limit = BLK_BOUNCE_HIGH; |
119 | int ret; | 119 | int ret; |
120 | unsigned int bouncesz; | ||
121 | 120 | ||
122 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) | 121 | if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask) |
123 | limit = *mmc_dev(host)->dma_mask; | 122 | limit = *mmc_dev(host)->dma_mask; |
@@ -134,6 +133,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
134 | 133 | ||
135 | #ifdef CONFIG_MMC_BLOCK_BOUNCE | 134 | #ifdef CONFIG_MMC_BLOCK_BOUNCE |
136 | if (host->max_hw_segs == 1) { | 135 | if (host->max_hw_segs == 1) { |
136 | unsigned int bouncesz; | ||
137 | |||
137 | bouncesz = MMC_QUEUE_BOUNCESZ; | 138 | bouncesz = MMC_QUEUE_BOUNCESZ; |
138 | 139 | ||
139 | if (bouncesz > host->max_req_size) | 140 | if (bouncesz > host->max_req_size) |
@@ -156,14 +157,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
156 | GFP_KERNEL); | 157 | GFP_KERNEL); |
157 | if (!mq->sg) { | 158 | if (!mq->sg) { |
158 | ret = -ENOMEM; | 159 | ret = -ENOMEM; |
159 | goto free_bounce_buf; | 160 | goto cleanup_queue; |
160 | } | 161 | } |
161 | 162 | ||
162 | mq->bounce_sg = kmalloc(sizeof(struct scatterlist) * | 163 | mq->bounce_sg = kmalloc(sizeof(struct scatterlist) * |
163 | bouncesz / 512, GFP_KERNEL); | 164 | bouncesz / 512, GFP_KERNEL); |
164 | if (!mq->bounce_sg) { | 165 | if (!mq->bounce_sg) { |
165 | ret = -ENOMEM; | 166 | ret = -ENOMEM; |
166 | goto free_sg; | 167 | goto cleanup_queue; |
167 | } | 168 | } |
168 | } | 169 | } |
169 | } | 170 | } |
@@ -197,14 +198,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
197 | if (mq->bounce_sg) | 198 | if (mq->bounce_sg) |
198 | kfree(mq->bounce_sg); | 199 | kfree(mq->bounce_sg); |
199 | mq->bounce_sg = NULL; | 200 | mq->bounce_sg = NULL; |
200 | free_sg: | 201 | cleanup_queue: |
201 | kfree(mq->sg); | 202 | if (mq->sg) |
203 | kfree(mq->sg); | ||
202 | mq->sg = NULL; | 204 | mq->sg = NULL; |
203 | free_bounce_buf: | ||
204 | if (mq->bounce_buf) | 205 | if (mq->bounce_buf) |
205 | kfree(mq->bounce_buf); | 206 | kfree(mq->bounce_buf); |
206 | mq->bounce_buf = NULL; | 207 | mq->bounce_buf = NULL; |
207 | cleanup_queue: | ||
208 | blk_cleanup_queue(mq->queue); | 208 | blk_cleanup_queue(mq->queue); |
209 | return ret; | 209 | return ret; |
210 | } | 210 | } |