diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2017-03-19 06:26:28 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-04 09:48:23 -0600 |
commit | d19eef029dad7600b69968036e877cdcf51e860d (patch) | |
tree | d84264dfeadb46e21bcbc267e0c897a0ee8bcfb3 | |
parent | a56c79cfd3e97706ad5615831c3bab01fb4047c4 (diff) |
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 <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/target/loop.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) |