After the patch "block: add flag for add_disk() completion notation" we no longer need to check the disk was added prior to calling del_gendisk(), del_gendisk() now deals with the check for us. Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx> --- drivers/md/bcache/super.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 185246a0d855..70ee7a22b2a3 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -885,11 +885,7 @@ static void bcache_device_free(struct bcache_device *d) bcache_device_detach(d); if (disk) { - bool disk_added = (disk->flags & GENHD_FL_UP) != 0; - - if (disk_added) - del_gendisk(disk); - + del_gendisk(disk); blk_cleanup_disk(disk); ida_simple_remove(&bcache_device_idx, first_minor_to_idx(disk->first_minor)); -- 2.27.0