aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/sbus/char/jsflash.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index d56ddaa7703..f572a4a1d14 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -186,31 +186,37 @@ static void jsfd_do_request(struct request_queue *q)
186{ 186{
187 struct request *req; 187 struct request *req;
188 188
189 while ((req = elv_next_request(q)) != NULL) { 189 req = elv_next_request(q);
190 if (req)
191 blkdev_dequeue_request(req);
192
193 while (req) {
190 struct jsfd_part *jdp = req->rq_disk->private_data; 194 struct jsfd_part *jdp = req->rq_disk->private_data;
191 unsigned long offset = blk_rq_pos(req) << 9; 195 unsigned long offset = blk_rq_pos(req) << 9;
192 size_t len = blk_rq_cur_bytes(req); 196 size_t len = blk_rq_cur_bytes(req);
197 int err = -EIO;
193 198
194 if ((offset + len) > jdp->dsize) { 199 if ((offset + len) > jdp->dsize)
195 __blk_end_request_cur(req, -EIO); 200 goto end;
196 continue;
197 }
198 201
199 if (rq_data_dir(req) != READ) { 202 if (rq_data_dir(req) != READ) {
200 printk(KERN_ERR "jsfd: write\n"); 203 printk(KERN_ERR "jsfd: write\n");
201 __blk_end_request_cur(req, -EIO); 204 goto end;
202 continue;
203 } 205 }
204 206
205 if ((jdp->dbase & 0xff000000) != 0x20000000) { 207 if ((jdp->dbase & 0xff000000) != 0x20000000) {
206 printk(KERN_ERR "jsfd: bad base %x\n", (int)jdp->dbase); 208 printk(KERN_ERR "jsfd: bad base %x\n", (int)jdp->dbase);
207 __blk_end_request_cur(req, -EIO); 209 goto end;
208 continue;
209 } 210 }
210 211
211 jsfd_read(req->buffer, jdp->dbase + offset, len); 212 jsfd_read(req->buffer, jdp->dbase + offset, len);
212 213 err = 0;
213 __blk_end_request_cur(req, 0); 214 end:
215 if (!__blk_end_request_cur(req, err)) {
216 req = elv_next_request(q);
217 if (req)
218 blkdev_dequeue_request(req);
219 }
214 } 220 }
215} 221}
216 222