Skip to content

Commit

Permalink
nvme: don't enable AEN if not supported
Browse files Browse the repository at this point in the history
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 <sagi@grimberg.me>
Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Weiping Zhang authored and Christoph Hellwig committed Jul 17, 2018
1 parent cf39a6b commit fa441b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,14 +1060,17 @@ EXPORT_SYMBOL_GPL(nvme_set_queue_count);

static void nvme_enable_aen(struct nvme_ctrl *ctrl)
{
u32 result;
u32 result, supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;
int status;

status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);
if (!supported_aens)
return;

status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens,
NULL, 0, &result);
if (status)
dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
ctrl->oaes & NVME_AEN_SUPPORTED);
supported_aens);
}

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

0 comments on commit fa441b7

Please sign in to comment.