summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Sandoval2018-10-11 21:20:41 +0200
committerJens Axboe2018-10-16 17:49:08 +0200
commit1448a2a5360ae06f25e2edc61ae070dff5c0beb4 (patch)
tree880b3eeb679e9b96cd52c52c677a258a224ef16d
parentmtd_blkdevs: convert to blk-mq (diff)
downloadkernel-qcow2-linux-1448a2a5360ae06f25e2edc61ae070dff5c0beb4.tar.gz
kernel-qcow2-linux-1448a2a5360ae06f25e2edc61ae070dff5c0beb4.tar.xz
kernel-qcow2-linux-1448a2a5360ae06f25e2edc61ae070dff5c0beb4.zip
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>
-rw-r--r--drivers/block/swim.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 0e31884a9519..cbe909c51847 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -887,8 +887,17 @@ static int swim_floppy_init(struct swim_priv *swd)
exit_put_disks:
unregister_blkdev(FLOPPY_MAJOR, "fd");
- while (drive--)
- put_disk(swd->unit[drive].disk);
+ do {
+ 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;
}