Skip to content

Commit adce7e9

Browse files
edmundnakeithbusch
authored andcommitted
nvme: remove unused return code from nvme_alloc_ns
The return code of nvme_alloc_ns is never used, so change it to void. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Edmund Nadolski <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 8b614cb commit adce7e9

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

drivers/nvme/host/core.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,7 +3480,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns)
34803480
return 0;
34813481
}
34823482

3483-
static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
3483+
static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
34843484
{
34853485
struct nvme_ns *ns;
34863486
struct gendisk *disk;
@@ -3490,13 +3490,11 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
34903490

34913491
ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node);
34923492
if (!ns)
3493-
return -ENOMEM;
3493+
return;
34943494

34953495
ns->queue = blk_mq_init_queue(ctrl->tagset);
3496-
if (IS_ERR(ns->queue)) {
3497-
ret = PTR_ERR(ns->queue);
3496+
if (IS_ERR(ns->queue))
34983497
goto out_free_ns;
3499-
}
35003498

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

3522-
if (id->ncap == 0) {
3523-
ret = -EINVAL;
3520+
if (id->ncap == 0) /* no namespace (legacy quirk) */
35243521
goto out_free_id;
3525-
}
35263522

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

35333529
disk = alloc_disk_node(0, node);
3534-
if (!disk) {
3535-
ret = -ENOMEM;
3530+
if (!disk)
35363531
goto out_unlink_ns;
3537-
}
35383532

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

3568-
return 0;
3562+
return;
35693563
out_put_disk:
35703564
put_disk(ns->disk);
35713565
out_unlink_ns:
@@ -3579,9 +3573,6 @@ static int nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
35793573
blk_cleanup_queue(ns->queue);
35803574
out_free_ns:
35813575
kfree(ns);
3582-
if (ret > 0)
3583-
ret = blk_status_to_errno(nvme_error_status(ret));
3584-
return ret;
35853576
}
35863577

35873578
static void nvme_ns_remove(struct nvme_ns *ns)

0 commit comments

Comments
 (0)