From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/7] ide: BUG() on unknown requests
Date: Wed, 13 May 2009 22:51:46 +0200 [thread overview]
Message-ID: <20090513205146.28638.37593.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090513205139.28638.87226.sendpatchset@localhost.localdomain>
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 | 8 ++------
drivers/ide/ide-disk.c | 9 +--------
drivers/ide/ide-floppy.c | 6 ++----
drivers/ide/ide-tape.c | 10 +---------
4 files changed, 6 insertions(+), 27 deletions(-)
Index: b/drivers/ide/ide-cd.c
===================================================================
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -831,12 +831,8 @@ static ide_startstop_t ide_cd_do_request
/* 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: b/drivers/ide/ide-disk.c
===================================================================
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -184,14 +184,7 @@ static ide_startstop_t ide_do_rw_disk(id
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: b/drivers/ide/ide-floppy.c
===================================================================
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -272,10 +272,8 @@ static ide_startstop_t ide_floppy_do_req
} 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: b/drivers/ide/ide-tape.c
===================================================================
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -620,15 +620,7 @@ static ide_startstop_t idetape_do_reques
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) {
next prev parent reply other threads:[~2009-05-13 20:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-13 20:51 [PATCH 0/7] ide: minor improvements/cleanups Bartlomiej Zolnierkiewicz
2009-05-13 20:51 ` Bartlomiej Zolnierkiewicz [this message]
2009-05-13 20:51 ` [PATCH 2/7] ide: BUG() on unknown flags in ide_disk_special() Bartlomiej Zolnierkiewicz
2009-05-13 20:52 ` [PATCH 3/7] ide: merge ide_disk_special() into do_special() Bartlomiej Zolnierkiewicz
2009-05-13 20:55 ` Joe Perches
2009-05-14 12:23 ` Sergei Shtylyov
2009-05-17 17:00 ` Bartlomiej Zolnierkiewicz
2009-05-18 21:40 ` Sergei Shtylyov
2009-05-13 20:52 ` [PATCH 4/7] ide: replace special_t typedef by IDE_SFLAG_* flags Bartlomiej Zolnierkiewicz
2009-05-14 13:04 ` Sergei Shtylyov
2009-05-13 20:52 ` [PATCH 5/7] ide: remove chipset field from hw_regs_t Bartlomiej Zolnierkiewicz
2009-05-14 17:08 ` Sergei Shtylyov
2009-05-13 20:52 ` [PATCH 6/7] ide: pass number of ports to ide_host_{alloc,add}() Bartlomiej Zolnierkiewicz
2009-05-14 18:59 ` Sergei Shtylyov
2009-05-14 19:51 ` Bartlomiej Zolnierkiewicz
2009-05-14 20:19 ` Sergei Shtylyov
2009-05-17 17:00 ` Bartlomiej Zolnierkiewicz
2009-05-13 20:52 ` [PATCH 7/7] ide: remove hw_regs_t typedef Bartlomiej Zolnierkiewicz
2009-05-15 12:17 ` Sergei Shtylyov
2009-05-13 21:44 ` [PATCH 0/7] ide: minor improvements/cleanups Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090513205146.28638.37593.sendpatchset@localhost.localdomain \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).