Skip to contentSkip to conversation

nvme: Fix missing error code in nvme_configure_directives()

PATCH NAK Jiapeng Chong 3 participants 3 messages Feb 15, 2022 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Fix missing error code in nvme_configure_directives()

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:780 nvme_configure_directives() warn: missing error code 'ret'.

---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
index 79005ea1a33e..53b37f333170 100644
@@ -777,6 +777,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;
 	}
 
Signature · 1 line
2.20.1.7.g153144c
maintainer NAK
#1 lore raw
Quoted 7 lines · Jiapeng Chong

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:780 nvme_configure_directives() warn: missing error code 'ret'.

Nak, the code is correct as-is, just like it was the previous time you posted this patch:

http://lists.infradead.org/pipermail/linux-nvme/2021-September/027339.html

#2 lore raw

Le 15/02/2022 à 04:55, Keith Busch a écrit :

Quoted 6 lines · Jiapeng Chong
Quoted 5 lines

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

Eliminate the follow smatch warning:

Quoted 8 lines
Quoted 2 lines

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

Nak, the code is correct as-is, just like it was the previous time you posted this patch:

   http://lists.infradead.org/pipermail/linux-nvme/2021-September/027339.html

Hi,

maybe an explicit 'ret = 0;' (and eventually a comment saying why) would help here?

The code really looks like an error handling path (and will keep getting some patches for it because of bots).

Just my 2c.

CJ