aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-08-09 08:28:02 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-08-09 08:37:17 -0400
commitaafabfab26bf4968b5c6423a3c53e920ae8fa406 (patch)
treeb5413570e8fc6f1d6f8a2154c64e537352f32e69 /drivers/mmc
parentb3627bb19f8f0ca12136d985d4d73c437cba0e14 (diff)
mmc: reorganize bounce buffer init
Reorganize the code that initializes mmc_block's bounce buffer in order to avoid warnings when MMC_BLOCK_BOUNCE isn't used. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/card/queue.c14
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}