All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: don't enable AEN if not supported
@ 2018-07-01 13:08 Weiping Zhang
  2018-07-02  9:48 ` Sagi Grimberg
  2018-07-02 13:15 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Weiping Zhang @ 2018-07-01 13:08 UTC (permalink / raw)


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

Signed-off-by: Weiping Zhang <zhangweiping at didichuxing.com>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index e541fe268bcf..d38e2016ffaa 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1044,6 +1044,9 @@ static void nvme_enable_aen(struct nvme_ctrl *ctrl)
 	u32 result;
 	int status;
 
+	if (!(ctrl->oaes & NVME_AEN_SUPPORTED))
+		return;
+
 	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT,
 			ctrl->oaes & NVME_AEN_SUPPORTED, NULL, 0, &result);
 	if (status)
-- 
2.14.1

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

* [PATCH] nvme: don't enable AEN if not supported
  2018-07-01 13:08 [PATCH] nvme: don't enable AEN if not supported Weiping Zhang
@ 2018-07-02  9:48 ` Sagi Grimberg
  2018-07-02 13:15 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2018-07-02  9:48 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

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

* [PATCH] nvme: don't enable AEN if not supported
  2018-07-01 13:08 [PATCH] nvme: don't enable AEN if not supported Weiping Zhang
  2018-07-02  9:48 ` Sagi Grimberg
@ 2018-07-02 13:15 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2018-07-02 13:15 UTC (permalink / raw)


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

Can you introduce do something like:

	u32 supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;

	if (!supported_aens)
		return;

	status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens,
	...

to make the code more obvious?  Otherwise looks fine:

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

end of thread, other threads:[~2018-07-02 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01 13:08 [PATCH] nvme: don't enable AEN if not supported Weiping Zhang
2018-07-02  9:48 ` Sagi Grimberg
2018-07-02 13:15 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.