From: Sagi Grimberg Date: Sun, 19 Mar 2017 04:26:28 +0000 (+0200) Subject: nvme-loop: fix module_init (theoretical) error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d19eef029dad7600b69968036e877cdcf51e860d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git nvme-loop: fix module_init (theoretical) error path if nvmf_register_transport happend to fail, we need to nvmet_unregister_transport as well. Signed-off-by: Sagi Grimberg Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index a74cd11e63c6..c95c13898bcb 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -745,7 +745,12 @@ static int __init nvme_loop_init_module(void) ret = nvmet_register_transport(&nvme_loop_ops); if (ret) return ret; - return nvmf_register_transport(&nvme_loop_transport); + + ret = nvmf_register_transport(&nvme_loop_transport); + if (ret) + nvmet_unregister_transport(&nvme_loop_ops); + + return ret; } static void __exit nvme_loop_cleanup_module(void)