diff options
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r-- | drivers/block/floppy.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 510fb10ec45a..9baf11e86362 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4368,8 +4368,14 @@ out_unreg_blkdev: | |||
4368 | out_put_disk: | 4368 | out_put_disk: |
4369 | while (dr--) { | 4369 | while (dr--) { |
4370 | del_timer_sync(&motor_off_timer[dr]); | 4370 | del_timer_sync(&motor_off_timer[dr]); |
4371 | if (disks[dr]->queue) | 4371 | if (disks[dr]->queue) { |
4372 | blk_cleanup_queue(disks[dr]->queue); | 4372 | blk_cleanup_queue(disks[dr]->queue); |
4373 | /* | ||
4374 | * put_disk() is not paired with add_disk() and | ||
4375 | * will put queue reference one extra time. fix it. | ||
4376 | */ | ||
4377 | disks[dr]->queue = NULL; | ||
4378 | } | ||
4373 | put_disk(disks[dr]); | 4379 | put_disk(disks[dr]); |
4374 | } | 4380 | } |
4375 | return err; | 4381 | return err; |
@@ -4579,6 +4585,15 @@ static void __exit floppy_module_exit(void) | |||
4579 | platform_device_unregister(&floppy_device[drive]); | 4585 | platform_device_unregister(&floppy_device[drive]); |
4580 | } | 4586 | } |
4581 | blk_cleanup_queue(disks[drive]->queue); | 4587 | blk_cleanup_queue(disks[drive]->queue); |
4588 | |||
4589 | /* | ||
4590 | * These disks have not called add_disk(). Don't put down | ||
4591 | * queue reference in put_disk(). | ||
4592 | */ | ||
4593 | if (!(allowed_drive_mask & (1 << drive)) || | ||
4594 | fdc_state[FDC(drive)].version == FDC_NONE) | ||
4595 | disks[drive]->queue = NULL; | ||
4596 | |||
4582 | put_disk(disks[drive]); | 4597 | put_disk(disks[drive]); |
4583 | } | 4598 | } |
4584 | 4599 | ||