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>

authored by Weiping Zhang and committed by Christoph Hellwig fa441b71 cf39a6bc

Changed files
+7 -4
drivers
nvme
host
+7 -4
drivers/nvme/host/core.c
··· 1060 1060 1061 1061 static void nvme_enable_aen(struct nvme_ctrl *ctrl) 1062 1062 { 1063 - u32 result; 1063 + u32 result, supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED; 1064 1064 int status; 1065 1065 1066 - status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, 1067 - ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result); 1066 + if (!supported_aens) 1067 + return; 1068 + 1069 + status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens, 1070 + NULL, 0, &result); 1068 1071 if (status) 1069 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 1073 1076 static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)