Commit 6b9d9c35 authored by Asai Thambi SP's avatar Asai Thambi SP Committed by Sasha Levin

mtip32xx: fix rmmod issue

[ Upstream commit 02b48265 ]

put_disk() need to be called after del_gendisk() to free the disk object structure.
Signed-off-by: default avatarSelvan Mani <smani@micron.com>
Signed-off-by: default avatarAsai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 15d38f73
...@@ -2813,6 +2813,7 @@ static int mtip_free_orphan(struct driver_data *dd) ...@@ -2813,6 +2813,7 @@ static int mtip_free_orphan(struct driver_data *dd)
kobject_put(kobj); kobject_put(kobj);
} }
del_gendisk(dd->disk); del_gendisk(dd->disk);
put_disk(dd->disk);
dd->disk = NULL; dd->disk = NULL;
} }
if (dd->queue) { if (dd->queue) {
...@@ -4103,13 +4104,13 @@ static int mtip_block_remove(struct driver_data *dd) ...@@ -4103,13 +4104,13 @@ static int mtip_block_remove(struct driver_data *dd)
dd->bdev = NULL; dd->bdev = NULL;
} }
if (dd->disk) { if (dd->disk) {
del_gendisk(dd->disk);
if (dd->disk->queue) { if (dd->disk->queue) {
del_gendisk(dd->disk);
blk_cleanup_queue(dd->queue); blk_cleanup_queue(dd->queue);
blk_mq_free_tag_set(&dd->tags); blk_mq_free_tag_set(&dd->tags);
dd->queue = NULL; dd->queue = NULL;
} else }
put_disk(dd->disk); put_disk(dd->disk);
} }
dd->disk = NULL; dd->disk = NULL;
...@@ -4148,12 +4149,12 @@ static int mtip_block_shutdown(struct driver_data *dd) ...@@ -4148,12 +4149,12 @@ static int mtip_block_shutdown(struct driver_data *dd)
dev_info(&dd->pdev->dev, dev_info(&dd->pdev->dev,
"Shutting down %s ...\n", dd->disk->disk_name); "Shutting down %s ...\n", dd->disk->disk_name);
del_gendisk(dd->disk);
if (dd->disk->queue) { if (dd->disk->queue) {
del_gendisk(dd->disk);
blk_cleanup_queue(dd->queue); blk_cleanup_queue(dd->queue);
blk_mq_free_tag_set(&dd->tags); blk_mq_free_tag_set(&dd->tags);
} else }
put_disk(dd->disk); put_disk(dd->disk);
dd->disk = NULL; dd->disk = NULL;
dd->queue = NULL; dd->queue = NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment