nvme: fix an error code in nvme_init_subsystem()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 23 Sep 2019 14:18:36 +0000 (17:18 +0300)
committerSagi Grimberg <sagi@grimberg.me>
Wed, 25 Sep 2019 19:53:14 +0000 (12:53 -0700)
"ret" should be a negative error code here, but it's either success or
possibly uninitialized.

Fixes: 32fd90c40768 ("nvme: change locking for the per-subsystem controller list")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/host/core.c

index 0c385b1994fe0e36d0351978fb36c19942129fe9..d3c9df62a9d5cf589dfe5483b4f0cb21beb8faf8 100644 (file)
@@ -2543,8 +2543,9 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
                list_add_tail(&subsys->entry, &nvme_subsystems);
        }
 
-       if (sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj,
-                       dev_name(ctrl->device))) {
+       ret = sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj,
+                               dev_name(ctrl->device));
+       if (ret) {
                dev_err(ctrl->device,
                        "failed to create sysfs link from subsystem.\n");
                goto out_put_subsystem;