OSDN Git Service

bcache: rework error unwinding in register_bcache
authorChristoph Hellwig <hch@lst.de>
Thu, 23 Jan 2020 17:01:28 +0000 (01:01 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 Jan 2020 18:40:01 +0000 (11:40 -0700)
commit50246693f81fe887f4db78bf7089051d7f1894cc
treeb0ad1f8d4099ea59194c6efea8fd38806ce6a83c
parenta702a692cd7559053ea573f4e2c84828f0e62824
bcache: rework error unwinding in register_bcache

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>
drivers/md/bcache/super.c