From e3a8832ce581dc27f6cd8adafd70219c2cc5cd1f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 15 Jun 2021 11:00:15 +0200 Subject: [PATCH] floppy: use blk_cleanup_disk Use blk_cleanup_disk instead of open coding it and cleanup the strange exist ordering and clearing of pointers that is not required. Signed-off-by: Christoph Hellwig --- drivers/block/floppy.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 87460e0e5c72..6077f29423c4 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4948,28 +4948,13 @@ static void __exit floppy_module_exit(void) } platform_device_unregister(&floppy_device[drive]); } - for (i = 0; i < ARRAY_SIZE(floppy_type); i++) { - if (disks[drive][i]) - blk_cleanup_queue(disks[drive][i]->queue); - } - blk_mq_free_tag_set(&tag_sets[drive]); - - /* - * These disks have not called add_disk(). Don't put down - * queue reference in put_disk(). - */ - if (!(allowed_drive_mask & (1 << drive)) || - fdc_state[FDC(drive)].version == FDC_NONE) { - for (i = 0; i < ARRAY_SIZE(floppy_type); i++) { - if (disks[drive][i]) - disks[drive][i]->queue = NULL; - } - } for (i = 0; i < ARRAY_SIZE(floppy_type); i++) { if (disks[drive][i]) - put_disk(disks[drive][i]); + blk_cleanup_disk(disks[drive][i]); } + + blk_mq_free_tag_set(&tag_sets[drive]); } cancel_delayed_work_sync(&fd_timeout); -- 2.50.1