nvme: don't enable AEN if not supported
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
@@ -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
Sagi Grimberg
maintainerPATCH 1/1 nvme: don't enable AEN if not supported
Reviewed-by Sagi Grimberg <sagi at grimberg.me>
Christoph Hellwig
maintainerPATCH 1/1 nvme: don't enable AEN if not supported
In reply to Weiping Zhangdrivers/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>