ide: BUG() on unknown requests
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 15 Jun 2009 20:16:10 +0000 (22:16 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Mon, 15 Jun 2009 20:16:10 +0000 (22:16 +0200)
Unsupported requests should be never handed down to device drivers
and the best thing we can do upon discovering such request inside
driver's ->do_request method is to just BUG().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-cd.c
drivers/ide/ide-disk.c
drivers/ide/ide-floppy.c
drivers/ide/ide-tape.c

index dcd72445b0cde33a9ded609516e232009ee6f5c1..0b7645b13df14211dcf38fd9e433e1097b5b4298 100644 (file)
@@ -785,12 +785,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
                /* right now this can only be a reset... */
                uptodate = 1;
                goto out_end;
-       } else {
-               blk_dump_rq_flags(rq, DRV_NAME " bad flags");
-               if (rq->errors == 0)
-                       rq->errors = -EIO;
-               goto out_end;
-       }
+       } else
+               BUG();
 
        /* prepare sense request for this command */
        ide_prep_sense(drive, rq);
index 6a1de21697096525d19b850ffbfba2f99a129c88..695181120cdb9f14d0a16740c901345d599d052b 100644 (file)
@@ -184,14 +184,7 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
        ide_hwif_t *hwif = drive->hwif;
 
        BUG_ON(drive->dev_flags & IDE_DFLAG_BLOCKED);
-
-       if (!blk_fs_request(rq)) {
-               blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command");
-               if (rq->errors == 0)
-                       rq->errors = -EIO;
-               ide_complete_rq(drive, -EIO, ide_rq_bytes(rq));
-               return ide_stopped;
-       }
+       BUG_ON(!blk_fs_request(rq));
 
        ledtrig_ide_activity();
 
index 800c83a9db831afe175922d3c933da53e83cdbd7..8b3f204f7d7325955b52b277ede13ab83984aa2e 100644 (file)
@@ -269,10 +269,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
        } else if (blk_pc_request(rq)) {
                pc = &floppy->queued_pc;
                idefloppy_blockpc_cmd(floppy, pc, rq);
-       } else {
-               blk_dump_rq_flags(rq, PFX "unsupported command in queue");
-               goto out_end;
-       }
+       } else
+               BUG();
 
        ide_prep_sense(drive, rq);
 
index 3a3f10f3f8feb90ad49f85b0dad3af23b516d74b..013dc595fab63754b391b33a7efd6b3e287167c3 100644 (file)
@@ -586,15 +586,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
        debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %u\n"
                  (unsigned long long)blk_rq_pos(rq), blk_rq_sectors(rq));
 
-       if (!(blk_special_request(rq) || blk_sense_request(rq))) {
-               /* We do not support buffer cache originated requests. */
-               printk(KERN_NOTICE "ide-tape: %s: Unsupported request in "
-                       "request queue (%d)\n", drive->name, rq->cmd_type);
-               if (blk_fs_request(rq) == 0 && rq->errors == 0)
-                       rq->errors = -EIO;
-               ide_complete_rq(drive, -EIO, ide_rq_bytes(rq));
-               return ide_stopped;
-       }
+       BUG_ON(!(blk_special_request(rq) || blk_sense_request(rq)));
 
        /* Retry a failed packet command */
        if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {