Message ID | 20180228181533.29402-3-bart.vanassche@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/drivers/md/md.c b/drivers/md/md.c index bc67ab6844f0..eba7fa2f0abb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5203,12 +5203,12 @@ static void md_free(struct kobject *ko) if (mddev->sysfs_state) sysfs_put(mddev->sysfs_state); + if (mddev->gendisk) + del_gendisk(mddev->gendisk); if (mddev->queue) blk_cleanup_queue(mddev->queue); - if (mddev->gendisk) { - del_gendisk(mddev->gendisk); + if (mddev->gendisk) put_disk(mddev->gendisk); - } percpu_ref_exit(&mddev->writes_pending); kfree(mddev);