Skip to contentSkip to conversation

nvme: don't enable AEN if not supported

PATCH Superseded Weiping Zhang 3 participants 3 messages Jul 1, 2018 – Jul 2, 2018 NVMe

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: don't enable AEN if not supported

Avoid excuting set_feature command if there is no supported bit in Optional Asynchronous Events Supported (OAES).

Signed-off-by Weiping Zhang <zhangweiping at didichuxing.com>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/nvme/host/core.c +3 -0
index e541fe268bcf..d38e2016ffaa 100644
@@ -1044,6 +1044,9 @@ static void nvme_enable_aen(struct nvme_ctrl *ctrl)
 	u32 result;
 	int status;
 
+	if (!(ctrl->oaes & NVME_AEN_SUPPORTED))
+		return;
+
 	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
 			ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);
 	if (status)
Signature · 1 line
2.14.1
maintainer
#1 lore raw

PATCH 1/1 nvme: don't enable AEN if not supported

Reviewed-by Sagi Grimberg <sagi at grimberg.me>
#2 lore raw

PATCH 1/1 nvme: don't enable AEN if not supported

In reply to Weiping Zhang

drivers/nvme/host/core.c static void nvme_enable_aen(struct nvme_ctrl *ctrl) · line 1051

Quoted 5 lines
drivers/nvme/host/core.c +3 -0
+	if (!(ctrl->oaes & NVME_AEN_SUPPORTED))
+		return;
+
 	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
 			ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);

Can you introduce do something like:

	u32 supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;

	if (!supported_aens)
		return;

	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens,
	...

to make the code more obvious? Otherwise looks fine:

Reviewed-by Christoph Hellwig <hch at lst.de>