Also add error flow in case srcu initialization function fails.
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
                goto out_free_head;
        head->instance = ret;
        INIT_LIST_HEAD(&head->list);
-       init_srcu_struct(&head->srcu);
+       ret = init_srcu_struct(&head->srcu);
+       if (ret)
+               goto out_ida_remove;
        head->subsys = ctrl->subsys;
        head->ns_id = nsid;
        kref_init(&head->ref);
        return head;
 out_cleanup_srcu:
        cleanup_srcu_struct(&head->srcu);
+out_ida_remove:
        ida_simple_remove(&ctrl->subsys->ns_ida, head->instance);
 out_free_head:
        kfree(head);