linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] nvme: don't enable AEN if not supported
@ 2018-07-02 16:34 Weiping Zhang
  2018-07-03  6:42 ` Johannes Thumshirn
  2018-07-17 14:32 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: Weiping Zhang @ 2018-07-02 16:34 UTC (permalink / raw)


Avoid excuting set_feature command if there is no supported bit in
Optional Asynchronous Events Supported (OAES).

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: Christoph Hellwig <hch at lst.de>
Signed-off-by: Weiping Zhang <zhangweiping at didichuxing.com>
---
Change since V1:
* Add extra variable supported_aens sugguested by Christoph.

 drivers/nvme/host/core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e541fe268bcf..5ff281cce2b9 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1041,14 +1041,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)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-17 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-02 16:34 [PATCH v2] nvme: don't enable AEN if not supported Weiping Zhang
2018-07-03  6:42 ` Johannes Thumshirn
2018-07-17 14:14   ` Weiping Zhang
2018-07-17 14:32 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).