diff options
-rw-r--r-- | drivers/block/skd_main.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c index d0368682bd43..edab9c04e8ad 100644 --- a/drivers/block/skd_main.c +++ b/drivers/block/skd_main.c @@ -4539,15 +4539,16 @@ static void skd_free_disk(struct skd_device *skdev) { struct gendisk *disk = skdev->disk; - if (disk != NULL) { - struct request_queue *q = disk->queue; - - if (disk->flags & GENHD_FL_UP) - del_gendisk(disk); - if (q) - blk_cleanup_queue(q); - put_disk(disk); + if (disk && (disk->flags & GENHD_FL_UP)) + del_gendisk(disk); + + if (skdev->queue) { + blk_cleanup_queue(skdev->queue); + skdev->queue = NULL; + disk->queue = NULL; } + + put_disk(disk); skdev->disk = NULL; } |