mirror of
https://github.com/torvalds/linux.git
synced 2024-11-28 07:01:32 +00:00
swim: fix cleanup on setup error
If we fail to allocate the request queue for a disk, we still need to free that disk, not just the previous ones. Additionally, we need to cleanup the previous request queues. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
891b7c5fbf
commit
1448a2a536
@ -887,8 +887,17 @@ static int swim_floppy_init(struct swim_priv *swd)
|
|||||||
|
|
||||||
exit_put_disks:
|
exit_put_disks:
|
||||||
unregister_blkdev(FLOPPY_MAJOR, "fd");
|
unregister_blkdev(FLOPPY_MAJOR, "fd");
|
||||||
while (drive--)
|
do {
|
||||||
put_disk(swd->unit[drive].disk);
|
struct gendisk *disk = swd->unit[drive].disk;
|
||||||
|
|
||||||
|
if (disk) {
|
||||||
|
if (disk->queue) {
|
||||||
|
blk_cleanup_queue(disk->queue);
|
||||||
|
disk->queue = NULL;
|
||||||
|
}
|
||||||
|
put_disk(disk);
|
||||||
|
}
|
||||||
|
} while (drive--);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user