Skip to content

Commit fa441b7

Browse files
Weiping ZhangChristoph Hellwig
authored andcommitted
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: c0561f8 ("nvme: submit AEN event configuration on startup") Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Weiping Zhang <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent cf39a6b commit fa441b7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/nvme/host/core.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,14 +1060,17 @@ EXPORT_SYMBOL_GPL(nvme_set_queue_count);
10601060

10611061
static void nvme_enable_aen(struct nvme_ctrl *ctrl)
10621062
{
1063-
u32 result;
1063+
u32 result, supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;
10641064
int status;
10651065

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);
10681071
if (status)
10691072
dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
1070-
ctrl->oaes & NVME_AEN_SUPPORTED);
1073+
supported_aens);
10711074
}
10721075

10731076
static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)

0 commit comments

Comments
 (0)