block/ataflop: add registration bool before calling del_gendisk()
authorLuis Chamberlain <mcgrof@kernel.org>
Mon, 27 Sep 2021 22:03:00 +0000 (15:03 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:07 +0000 (19:17 +0100)
commit875ffb42476b2156da9dd96445a4e66b8e201086
tree4286795b86a0afa84ff01576f3eded315d5ff820
parent9d3261d4606a6d600910ec17dc592cd2b29c6ffa
block/ataflop: add registration bool before calling del_gendisk()

[ Upstream commit 573effb298011d3fcabc9b12025cf637f8a07911 ]

The ataflop assumes del_gendisk() is safe to call, this is only
true because add_disk() does not return a failure, but that will
change soon. And so, before we get to adding error handling for
that case, let's make sure we keep track of which disks actually
get registered. Then we use this to only call del_gendisk for them.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20210927220302.1073499-13-mcgrof@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/ataflop.c