diff options
-rw-r--r-- | drivers/nvme/host/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 695e52ae22fd..b09940c556d0 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
@@ -2832,7 +2832,9 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, | |||
2832 | goto out_free_head; | 2832 | goto out_free_head; |
2833 | head->instance = ret; | 2833 | head->instance = ret; |
2834 | INIT_LIST_HEAD(&head->list); | 2834 | INIT_LIST_HEAD(&head->list); |
2835 | init_srcu_struct(&head->srcu); | 2835 | ret = init_srcu_struct(&head->srcu); |
2836 | if (ret) | ||
2837 | goto out_ida_remove; | ||
2836 | head->subsys = ctrl->subsys; | 2838 | head->subsys = ctrl->subsys; |
2837 | head->ns_id = nsid; | 2839 | head->ns_id = nsid; |
2838 | kref_init(&head->ref); | 2840 | kref_init(&head->ref); |
@@ -2854,6 +2856,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, | |||
2854 | return head; | 2856 | return head; |
2855 | out_cleanup_srcu: | 2857 | out_cleanup_srcu: |
2856 | cleanup_srcu_struct(&head->srcu); | 2858 | cleanup_srcu_struct(&head->srcu); |
2859 | out_ida_remove: | ||
2857 | ida_simple_remove(&ctrl->subsys->ns_ida, head->instance); | 2860 | ida_simple_remove(&ctrl->subsys->ns_ida, head->instance); |
2858 | out_free_head: | 2861 | out_free_head: |
2859 | kfree(head); | 2862 | kfree(head); |