summary refs log tree commit diff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>2018-12-17 18:35:29 -0800
committerChristoph Hellwig <hch@lst.de>2018-12-18 17:50:44 +0100
commit5698b805fbf09a5dfa60829f5a179c0568a8dc3b (patch)
tree0bddf37535f8320b14c4f2b643c4edd70ead0bf6 /drivers/nvme
parent66c6afbd7321983be4c4160aff4d79e52af84a60 (diff)
downloadlinux-5698b805fbf09a5dfa60829f5a179c0568a8dc3b.tar.gz
nvmet: use a macro for default error location
This patch defines a new macro NVMET_NO_ERROR_LOC to represent the
default error location value in the nvme-error-log-page.
This is a pure cleanup patch and it does not change any functionality.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/target/core.c4
-rw-r--r--drivers/nvme/target/nvmet.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b9c219c931eb..88d260f31835 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -663,7 +663,7 @@ static void nvmet_set_error(struct nvmet_req *req, u16 status)
 
 	req->rsp->status = cpu_to_le16(status << 1);
 
-	if (!ctrl || req->error_loc == (u16)-1)
+	if (!ctrl || req->error_loc == NVMET_NO_ERROR_LOC)
 		return;
 
 	spin_lock_irqsave(&ctrl->error_lock, flags);
@@ -849,7 +849,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
 	req->rsp->status = 0;
 	req->rsp->sq_head = 0;
 	req->ns = NULL;
-	req->error_loc = -1;
+	req->error_loc = NVMET_NO_ERROR_LOC;
 	req->error_slba = 0;
 
 	/* no support for fused commands yet */
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 3b5f0bcaf3e8..3e4719fdba85 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -30,6 +30,7 @@
 
 #define NVMET_ASYNC_EVENTS		4
 #define NVMET_ERROR_LOG_SLOTS		128
+#define NVMET_NO_ERROR_LOC		((u16)-1)
 
 /*
  * Supported optional AENs: