Skip to content

Commit

Permalink
nvme: remove unused return code from nvme_alloc_ns
Browse files Browse the repository at this point in the history
The return code of nvme_alloc_ns is never used, so change it
to void.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Edmund Nadolski <edmund.nadolski@intel.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
  • Loading branch information
Edmund Nadolski authored and Keith Busch committed Mar 4, 2020
1 parent 8b614cb commit adce7e9
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3480,7 +3480,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
return 0;
}

static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
{
struct nvme_ns *ns;
struct gendisk *disk;
Expand All @@ -3490,13 +3490,11 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)

ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node);
if (!ns)
return -ENOMEM;
return;

ns->queue = blk_mq_init_queue(ctrl->tagset);
if (IS_ERR(ns->queue)) {
ret = PTR_ERR(ns->queue);
if (IS_ERR(ns->queue))
goto out_free_ns;
}

if (ctrl->opts && ctrl->opts->data_digest)
ns->queue->backing_dev_info->capabilities
Expand All @@ -3519,10 +3517,8 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
if (ret)
goto out_free_queue;

if (id->ncap == 0) {
ret = -EINVAL;
if (id->ncap == 0) /* no namespace (legacy quirk) */
goto out_free_id;
}

ret = nvme_init_ns_head(ns, nsid, id);
if (ret)
Expand All @@ -3531,10 +3527,8 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
nvme_set_disk_name(disk_name, ns, ctrl, &flags);

disk = alloc_disk_node(0, node);
if (!disk) {
ret = -ENOMEM;
if (!disk)
goto out_unlink_ns;
}

disk->fops = &nvme_fops;
disk->private_data = ns;
Expand Down Expand Up @@ -3565,7 +3559,7 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name);
kfree(id);

return 0;
return;
out_put_disk:
put_disk(ns->disk);
out_unlink_ns:
Expand All @@ -3579,9 +3573,6 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
blk_cleanup_queue(ns->queue);
out_free_ns:
kfree(ns);
if (ret > 0)
ret = blk_status_to_errno(nvme_error_status(ret));
return ret;
}

static void nvme_ns_remove(struct nvme_ns *ns)
Expand Down

0 comments on commit adce7e9

Please sign in to comment.