bcache: rework error unwinding in register_bcache
authorChristoph Hellwig <hch@lst.de>
Thu, 23 Jan 2020 17:01:28 +0000 (01:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:56 +0000 (08:36 +0100)
commit393b8509be3348d5b11a643f0d05597ce3ea4c7c
tree7b07bb47c1585ea8a827990d956bd97bc2a236fc
parentf7d8ebf26d239ed7f9cc4b940ff240d78c4b61d1
bcache: rework error unwinding in register_bcache

[ Upstream commit 50246693f81fe887f4db78bf7089051d7f1894cc ]

Split the successful and error return path, and use one goto label for each
resource to unwind.  This also fixes some small errors like leaking the
module reference count in the reboot case (which seems entirely harmless)
or printing the wrong warning messages for early failures.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/bcache/super.c