Skip to contentSkip to conversation

nvme: remove unnecessary return values

PATCH In review [email protected] 2 participants 3 messages Nov 11, 2020 – Nov 12, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: remove unnecessary return values

From: Javier González <[email protected]>

Cleanup unnecessary ret values that are not checked or used in nvme_alloc_ns()

---
 drivers/nvme/host/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/nvme/host/core.c +3 -5
index fff90200497c..c9ea32c87e52 100644
@@ -3830,7 +3830,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
 	struct gendisk *disk;
 	struct nvme_id_ns *id;
 	char disk_name[DISK_NAME_LEN];
-	int node = ctrl->numa_node, flags = GENHD_FL_EXT_DEVT, ret;
+	int node = ctrl->numa_node, flags = GENHD_FL_EXT_DEVT;
 
 	if (nvme_identify_ns(ctrl, nsid, ids, &id))
 		return;
@@ -3854,8 +3854,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
 	ns->ctrl = ctrl;
 	kref_init(&ns->kref);
 
-	ret = nvme_init_ns_head(ns, nsid, ids, id->nmic & NVME_NS_NMIC_SHARED);
-	if (ret)
+	if (nvme_init_ns_head(ns, nsid, ids, id->nmic & NVME_NS_NMIC_SHARED))
 		goto out_free_queue;
 	nvme_set_disk_name(disk_name, ns, ctrl, &flags);
 
@@ -3874,8 +3873,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
 		goto out_put_disk;
 
 	if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
-		ret = nvme_nvm_register(ns, disk_name, node);
-		if (ret) {
+		if (nvme_nvm_register(ns, disk_name, node)) {
 			dev_warn(ctrl->device, "LightNVM init failure\n");
 			goto out_put_disk;
 		}
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · On 11/11/20 12:10, [email protected] wrote:

From: Javier González <[email protected]>

Cleanup unnecessary ret values that are not checked or used in nvme_alloc_ns()

Signed-off-by Javier González <javier

The ret value pattern is used to avoid the calls in the if () which is

not clean based on the comments I had in the past.

_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#2 lore raw
Quoted 6 lines · Chaitanya Kulkarni
Quoted 2 lines · On 11/11/20 12:10, [email protected] wrote:

From: Javier González <[email protected]>

Quoted 8 lines
Quoted 4 lines

Cleanup unnecessary ret values that are not checked or used in nvme_alloc_ns()

Signed-off-by Javier González <javier

The ret value pattern is used to avoid the calls in the if () which is

not clean based on the comments I had in the past.

Thanks for the comment Chaitanya. I was working around this function and TBH I have never thought about it this way.

Will add it to the toolbelt then.