[PATCH] nvme: Fix missing error code in nvme_configure_directives()

From: Jiapeng Chong
Date: Thu Sep 09 2021 - 05:51:01 EST


From: chongjiapeng <jiapeng.chong@xxxxxxxxxxxxxxxxx>

The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'ret'.

Eliminate the follow smatch warning:

drivers/nvme/host/core.c:786 nvme_configure_directives() warn: missing
error code 'ret'.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Fixes: f5d118406247 ("nvme: add support for streams and directives")
Signed-off-by: chongjiapeng <jiapeng.chong@xxxxxxxxxxxxxxxxx>
---
drivers/nvme/host/core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 7efb31b..84abf1f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -783,6 +783,7 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) {
dev_info(ctrl->device, "too few streams (%u) available\n",
ctrl->nssa);
+ ret = -EINVAL;
goto out_disable_stream;
}

--
1.8.3.1