[PATCH 1/1] nvme: return err on nvme_init_non_mdts_limits fail
Joel Granados
j.granados at samsung.com
Wed Nov 2 10:17:08 PDT 2022
In nvme_init_non_mdts_limits function we were returning 0 when kzalloc
failed; it now returns -ENOMEM.
Fixes: 5befc7c26e5a ("nvme: implement non-mdts command limits")
Signed-off-by: Joel Granados <j.granados at samsung.com>
---
drivers/nvme/host/core.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 0090dc0b3ae6..e02a7ca2ed57 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3049,8 +3049,10 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
return 0;
id = kzalloc(sizeof(*id), GFP_KERNEL);
- if (!id)
- return 0;
+ if (!id) {
+ ret = -ENOMEM;
+ goto out;
+ }
c.identify.opcode = nvme_admin_identify;
c.identify.cns = NVME_ID_CNS_CS_CTRL;
@@ -3068,6 +3070,7 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
free_data:
kfree(id);
+out:
return ret;
}
--
2.30.2
More information about the Linux-nvme
mailing list