Commit 610827de authored by Peter Osterlund's avatar Peter Osterlund Committed by Linus Torvalds

[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: default avatarPeter Osterlund <petero2@telia.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1107d2e0
...@@ -669,7 +669,6 @@ static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, in ...@@ -669,7 +669,6 @@ static void pkt_make_local_copy(struct packet_data *pkt, struct page **pages, in
} }
offs += CD_FRAMESIZE; offs += CD_FRAMESIZE;
if (offs >= PAGE_SIZE) { if (offs >= PAGE_SIZE) {
BUG_ON(offs > PAGE_SIZE);
offs = 0; offs = 0;
p++; p++;
} }
...@@ -804,10 +803,11 @@ static struct packet_data *pkt_get_packet_data(struct pktcdvd_device *pd, int zo ...@@ -804,10 +803,11 @@ static struct packet_data *pkt_get_packet_data(struct pktcdvd_device *pd, int zo
list_del_init(&pkt->list); list_del_init(&pkt->list);
if (pkt->sector != zone) if (pkt->sector != zone)
pkt->cache_valid = 0; pkt->cache_valid = 0;
break; return pkt;
} }
} }
return pkt; BUG();
return NULL;
} }
static void pkt_put_packet_data(struct pktcdvd_device *pd, struct packet_data *pkt) static void pkt_put_packet_data(struct pktcdvd_device *pd, struct packet_data *pkt)
...@@ -951,7 +951,6 @@ static int pkt_handle_queue(struct pktcdvd_device *pd) ...@@ -951,7 +951,6 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
} }
pkt = pkt_get_packet_data(pd, zone); pkt = pkt_get_packet_data(pd, zone);
BUG_ON(!pkt);
pd->current_sector = zone + pd->settings.size; pd->current_sector = zone + pd->settings.size;
pkt->sector = zone; pkt->sector = zone;
...@@ -2211,7 +2210,6 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio) ...@@ -2211,7 +2210,6 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio)
* No matching packet found. Store the bio in the work queue. * No matching packet found. Store the bio in the work queue.
*/ */
node = mempool_alloc(pd->rb_pool, GFP_NOIO); node = mempool_alloc(pd->rb_pool, GFP_NOIO);
BUG_ON(!node);
node->bio = bio; node->bio = bio;
spin_lock(&pd->lock); spin_lock(&pd->lock);
BUG_ON(pd->bio_queue_size < 0); 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,7 +2417,6 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data;
VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode));
BUG_ON(!pd);
switch (cmd) { switch (cmd) {
/* /*
......
...@@ -166,6 +166,9 @@ struct packet_iosched ...@@ -166,6 +166,9 @@ struct packet_iosched
/* /*
* 32 buffers of 2048 bytes * 32 buffers of 2048 bytes
*/ */
#if (PAGE_SIZE % CD_FRAMESIZE) != 0
#error "PAGE_SIZE must be a multiple of CD_FRAMESIZE"
#endif
#define PACKET_MAX_SIZE 32 #define PACKET_MAX_SIZE 32
#define PAGES_PER_PACKET (PACKET_MAX_SIZE * CD_FRAMESIZE / PAGE_SIZE) #define PAGES_PER_PACKET (PACKET_MAX_SIZE * CD_FRAMESIZE / PAGE_SIZE)
#define PACKET_MAX_SECTORS (PACKET_MAX_SIZE * CD_FRAMESIZE >> 9) #define PACKET_MAX_SECTORS (PACKET_MAX_SIZE * CD_FRAMESIZE >> 9)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment