diff options
author | Adrian Bunk <bunk@kernel.org> | 2007-10-17 02:29:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:55 -0400 |
commit | 5a9df732b6a547aa843e8655044db9573d7b4e71 (patch) | |
tree | 0687553cb97d59eab96256e6785a980097e0c8df | |
parent | b012d346c0e914f505d92f730ad1758f73e2953b (diff) |
drivers/block/cciss.c: fix check-after-use
The Coverity checker spotted that we have already oops'ed if "disk"
was NULL.
Since "disk" being NULL seems impossible at this point this patch
removes the NULL check.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/block/cciss.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 5c269c00d6e..ca56a0e5cd5 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1582,38 +1582,36 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1582 | * allows us to delete disk zero but keep the controller registered. | 1582 | * allows us to delete disk zero but keep the controller registered. |
1583 | */ | 1583 | */ |
1584 | if (h->gendisk[0] != disk) { | 1584 | if (h->gendisk[0] != disk) { |
1585 | if (disk) { | 1585 | struct request_queue *q = disk->queue; |
1586 | struct request_queue *q = disk->queue; | 1586 | if (disk->flags & GENHD_FL_UP) |
1587 | if (disk->flags & GENHD_FL_UP) | 1587 | del_gendisk(disk); |
1588 | del_gendisk(disk); | 1588 | if (q) { |
1589 | if (q) { | 1589 | blk_cleanup_queue(q); |
1590 | blk_cleanup_queue(q); | 1590 | /* Set drv->queue to NULL so that we do not try |
1591 | /* Set drv->queue to NULL so that we do not try | 1591 | * to call blk_start_queue on this queue in the |
1592 | * to call blk_start_queue on this queue in the | 1592 | * interrupt handler |
1593 | * interrupt handler | 1593 | */ |
1594 | */ | 1594 | drv->queue = NULL; |
1595 | drv->queue = NULL; | 1595 | } |
1596 | } | 1596 | /* If clear_all is set then we are deleting the logical |
1597 | /* If clear_all is set then we are deleting the logical | 1597 | * drive, not just refreshing its info. For drives |
1598 | * drive, not just refreshing its info. For drives | 1598 | * other than disk 0 we will call put_disk. We do not |
1599 | * other than disk 0 we will call put_disk. We do not | 1599 | * do this for disk 0 as we need it to be able to |
1600 | * do this for disk 0 as we need it to be able to | 1600 | * configure the controller. |
1601 | * configure the controller. | 1601 | */ |
1602 | if (clear_all){ | ||
1603 | /* This isn't pretty, but we need to find the | ||
1604 | * disk in our array and NULL our the pointer. | ||
1605 | * This is so that we will call alloc_disk if | ||
1606 | * this index is used again later. | ||
1602 | */ | 1607 | */ |
1603 | if (clear_all){ | 1608 | for (i=0; i < CISS_MAX_LUN; i++){ |
1604 | /* This isn't pretty, but we need to find the | 1609 | if(h->gendisk[i] == disk){ |
1605 | * disk in our array and NULL our the pointer. | 1610 | h->gendisk[i] = NULL; |
1606 | * This is so that we will call alloc_disk if | 1611 | break; |
1607 | * this index is used again later. | ||
1608 | */ | ||
1609 | for (i=0; i < CISS_MAX_LUN; i++){ | ||
1610 | if(h->gendisk[i] == disk){ | ||
1611 | h->gendisk[i] = NULL; | ||
1612 | break; | ||
1613 | } | ||
1614 | } | 1612 | } |
1615 | put_disk(disk); | ||
1616 | } | 1613 | } |
1614 | put_disk(disk); | ||
1617 | } | 1615 | } |
1618 | } else { | 1616 | } else { |
1619 | set_capacity(disk, 0); | 1617 | set_capacity(disk, 0); |