diff options
author | Peter Osterlund <petero2@telia.com> | 2005-09-13 04:25:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-13 11:22:31 -0400 |
commit | 610827dee82731c7be5a135d750d194ac56881a9 (patch) | |
tree | db2fb39a27e31a396c4a5b61dc2b42bbd79a121a | |
parent | 1107d2e0352769b9bde6a4877c295b9309cdb877 (diff) |
[PATCH] pktcdvd: BUG_ON cleanups
Remove some redundant BUG_ON() statements in pktcdvd and move one run-time
check to compile-time.
Signed-off-by: Peter Osterlund <petero2@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/block/pktcdvd.c | 9 | ||||
-rw-r--r-- | include/linux/pktcdvd.h | 3 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index b443fe5eebe4..7e22a58926b8 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -669,7 +669,6 @@ static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, in | |||
669 | } | 669 | } |
670 | offs += CD_FRAMESIZE; | 670 | offs += CD_FRAMESIZE; |
671 | if (offs >= PAGE_SIZE) { | 671 | if (offs >= PAGE_SIZE) { |
672 | BUG_ON(offs > PAGE_SIZE); | ||
673 | offs = 0; | 672 | offs = 0; |
674 | p++; | 673 | p++; |
675 | } | 674 | } |
@@ -804,10 +803,11 @@ static struct packet_data *pkt_get_packet_data(struct pktcdvd_device *pd, int zo | |||
804 | list_del_init(&pkt->list); | 803 | list_del_init(&pkt->list); |
805 | if (pkt->sector != zone) | 804 | if (pkt->sector != zone) |
806 | pkt->cache_valid = 0; | 805 | pkt->cache_valid = 0; |
807 | break; | 806 | return pkt; |
808 | } | 807 | } |
809 | } | 808 | } |
810 | return pkt; | 809 | BUG(); |
810 | return NULL; | ||
811 | } | 811 | } |
812 | 812 | ||
813 | static void pkt_put_packet_data(struct pktcdvd_device *pd, struct packet_data *pkt) | 813 | static void pkt_put_packet_data(struct pktcdvd_device *pd, struct packet_data *pkt) |
@@ -951,7 +951,6 @@ try_next_bio: | |||
951 | } | 951 | } |
952 | 952 | ||
953 | pkt = pkt_get_packet_data(pd, zone); | 953 | pkt = pkt_get_packet_data(pd, zone); |
954 | BUG_ON(!pkt); | ||
955 | 954 | ||
956 | pd->current_sector = zone + pd->settings.size; | 955 | pd->current_sector = zone + pd->settings.size; |
957 | pkt->sector = zone; | 956 | pkt->sector = zone; |
@@ -2211,7 +2210,6 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio) | |||
2211 | * No matching packet found. Store the bio in the work queue. | 2210 | * No matching packet found. Store the bio in the work queue. |
2212 | */ | 2211 | */ |
2213 | node = mempool_alloc(pd->rb_pool, GFP_NOIO); | 2212 | node = mempool_alloc(pd->rb_pool, GFP_NOIO); |
2214 | BUG_ON(!node); | ||
2215 | node->bio = bio; | 2213 | node->bio = bio; |
2216 | spin_lock(&pd->lock); | 2214 | spin_lock(&pd->lock); |
2217 | BUG_ON(pd->bio_queue_size < 0); | 2215 | BUG_ON(pd->bio_queue_size < 0); |
@@ -2419,7 +2417,6 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
2419 | struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; | 2417 | struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; |
2420 | 2418 | ||
2421 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); | 2419 | VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); |
2422 | BUG_ON(!pd); | ||
2423 | 2420 | ||
2424 | switch (cmd) { | 2421 | switch (cmd) { |
2425 | /* | 2422 | /* |
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h index 4b32bce9a289..2c177e4c8f22 100644 --- a/include/linux/pktcdvd.h +++ b/include/linux/pktcdvd.h | |||
@@ -166,6 +166,9 @@ struct packet_iosched | |||
166 | /* | 166 | /* |
167 | * 32 buffers of 2048 bytes | 167 | * 32 buffers of 2048 bytes |
168 | */ | 168 | */ |
169 | #if (PAGE_SIZE % CD_FRAMESIZE) != 0 | ||
170 | #error "PAGE_SIZE must be a multiple of CD_FRAMESIZE" | ||
171 | #endif | ||
169 | #define PACKET_MAX_SIZE 32 | 172 | #define PACKET_MAX_SIZE 32 |
170 | #define PAGES_PER_PACKET (PACKET_MAX_SIZE * CD_FRAMESIZE / PAGE_SIZE) | 173 | #define PAGES_PER_PACKET (PACKET_MAX_SIZE * CD_FRAMESIZE / PAGE_SIZE) |
171 | #define PACKET_MAX_SECTORS (PACKET_MAX_SIZE * CD_FRAMESIZE >> 9) | 174 | #define PACKET_MAX_SECTORS (PACKET_MAX_SIZE * CD_FRAMESIZE >> 9) |