From: Colin Ian King Date: Fri, 14 Dec 2018 18:31:21 +0000 (+0000) Subject: nvmet: fix comparison of a u16 with -1 X-Git-Tag: for-4.21/block-20181221~4^2~12 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=66c6afbd7321983be4c4160aff4d79e52af84a60;p=linux-block.git 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: 76574f37bf4c ("nvmet: add interface to update error-log page") Signed-off-by: Colin Ian King Signed-off-by: Christoph Hellwig --- diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index cc81d0231587..b9c219c931eb 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 == -1) + if (!ctrl || req->error_loc == (u16)-1) return; spin_lock_irqsave(&ctrl->error_lock, flags);