md: properly unwind when failing to add the kobject in md_alloc
authorChristoph Hellwig <hch@lst.de>
Wed, 1 Sep 2021 11:38:33 +0000 (13:38 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 20:50:23 +0000 (14:50 -0600)
commit7ad1069166c0ccdd572d27e01cc7f7f84477df1e
tree0d1aca1a632d10208555d4212f5af9d30fef4ef7
parent94f3cd7d832c28681f1dea54b4dd8606e5e2bc75
md: properly unwind when failing to add the kobject in md_alloc

Add proper error handling to delete the gendisk when failing to add
the md kobject and clean up the error unwinding in general.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/md.c