aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/scsi_ioctl.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c
index b35cb75c7528..7717b76f7f20 100644
--- a/drivers/block/scsi_ioctl.c
+++ b/drivers/block/scsi_ioctl.c
@@ -216,7 +216,7 @@ static int sg_io(struct file *file, request_queue_t *q,
216 struct gendisk *bd_disk, struct sg_io_hdr *hdr) 216 struct gendisk *bd_disk, struct sg_io_hdr *hdr)
217{ 217{
218 unsigned long start_time; 218 unsigned long start_time;
219 int reading, writing, ret = 0; 219 int writing = 0, ret = 0;
220 struct request *rq; 220 struct request *rq;
221 struct bio *bio; 221 struct bio *bio;
222 char sense[SCSI_SENSE_BUFFERSIZE]; 222 char sense[SCSI_SENSE_BUFFERSIZE];
@@ -234,19 +234,15 @@ static int sg_io(struct file *file, request_queue_t *q,
234 if (hdr->dxfer_len > (q->max_sectors << 9)) 234 if (hdr->dxfer_len > (q->max_sectors << 9))
235 return -EIO; 235 return -EIO;
236 236
237 reading = writing = 0;
238 if (hdr->dxfer_len) 237 if (hdr->dxfer_len)
239 switch (hdr->dxfer_direction) { 238 switch (hdr->dxfer_direction) {
240 default: 239 default:
241 return -EINVAL; 240 return -EINVAL;
242 case SG_DXFER_TO_FROM_DEV: 241 case SG_DXFER_TO_FROM_DEV:
243 reading = 1;
244 /* fall through */
245 case SG_DXFER_TO_DEV: 242 case SG_DXFER_TO_DEV:
246 writing = 1; 243 writing = 1;
247 break; 244 break;
248 case SG_DXFER_FROM_DEV: 245 case SG_DXFER_FROM_DEV:
249 reading = 1;
250 break; 246 break;
251 } 247 }
252 248