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>
This commit is contained in:
Sagi Grimberg 2017-03-19 06:26:28 +02:00 committed by Jens Axboe
parent a56c79cfd3
commit d19eef029d

View File

@ -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)