aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWeiping Zhang <zhangweiping@didichuxing.com>2018-07-02 12:34:38 -0400
committerChristoph Hellwig <hch@lst.de>2018-07-17 10:30:27 -0400
commitfa441b71aa27d06fa79d5e7f7c329981dccd94d1 (patch)
tree3ca9e9a28eae6944ce9fc21977e115aff98d669e /drivers
parentcf39a6bc342b980f10f344d88035829638a89a48 (diff)
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). Fixes: c0561f82 ("nvme: submit AEN event configuration on startup") Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e7668c4bb4dd..57f33733237f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1060,14 +1060,17 @@ EXPORT_SYMBOL_GPL(nvme_set_queue_count);
1060 1060
1061static void nvme_enable_aen(struct nvme_ctrl *ctrl) 1061static void nvme_enable_aen(struct nvme_ctrl *ctrl)
1062{ 1062{
1063 u32 result; 1063 u32 result, supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;
1064 int status; 1064 int status;
1065 1065
1066 status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, 1066 if (!supported_aens)
1067 ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result); 1067 return;
1068
1069 status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens,
1070 NULL, 0, &result);
1068 if (status) 1071 if (status)
1069 dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n", 1072 dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
1070 ctrl->oaes & NVME_AEN_SUPPORTED); 1073 supported_aens);
1071} 1074}
1072 1075
1073static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) 1076static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)