Commit 66c6afbd authored by Colin Ian King's avatar Colin Ian King Committed by Christoph Hellwig

nvmet: fix comparison of a u16 with -1

Currently the u16 req->error_loc is being compared to -1 which
will always be false.  Fix this by casting -1 to u16 to fix this.

Detected by clang:
  warning: result of comparison of constant -1 with expression of
  type 'u16' (aka 'unsigned short') is always false
  [-Wtautological-constant-out-of-range-compare]

Fixes: 76574f37 ("nvmet: add interface to update error-log page")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent cd19181b
...@@ -663,7 +663,7 @@ static void nvmet_set_error(struct nvmet_req *req, u16 status) ...@@ -663,7 +663,7 @@ static void nvmet_set_error(struct nvmet_req *req, u16 status)
req->rsp->status = cpu_to_le16(status << 1); req->rsp->status = cpu_to_le16(status << 1);
if (!ctrl || req->error_loc == -1) if (!ctrl || req->error_loc == (u16)-1)
return; return;
spin_lock_irqsave(&ctrl->error_lock, flags); spin_lock_irqsave(&ctrl->error_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment