diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2017-03-19 05:26:28 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-04 17:48:23 +0200 |
commit | d19eef029dad7600b69968036e877cdcf51e860d (patch) | |
tree | d84264dfeadb46e21bcbc267e0c897a0ee8bcfb3 /drivers/nvme/target | |
parent | nvme-rdma: fix module_init (theoretical) error path (diff) | |
download | linux-d19eef029dad7600b69968036e877cdcf51e860d.tar.xz linux-d19eef029dad7600b69968036e877cdcf51e860d.zip |
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>
Diffstat (limited to 'drivers/nvme/target')
-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) |