nvme-core: fix unsigned comparison warning in nvme_wait_freeze_timeout
PATCH v2 1/1 nvme-core: fix unsigned comparison warning in nvme_wait_freeze_timeout
The timeout variable in nvme_wait_freeze_timeout() is an unsigned type. Checking if it is <= 0 triggers a compiler warning because an unsigned variable can never be negative.
Fix this warning by changing the type to long.
---
v2: keep the <= comparison, change the type from unsigned to signed long
drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
@@ -5246,7 +5246,7 @@ EXPORT_SYMBOL_GPL(nvme_unfreeze);int nvme_wait_freeze_timeout (struct nvme_ctrl *ctrl) { -unsigned long timeout = ctrl->io_timeout; +long timeout = ctrl->io_timeout;struct nvme_ns *ns;int srcu_idx;
Signature · 1 line
2.54.0
Quoted 23 lines · Maurizio Lombardi
The timeout variable in
nvme_wait_freeze_timeout()is an unsigned type. Checking if it is <= 0 triggers a compiler warning because an unsigned variable can never be negative.Fix this warning by changing the type to long.
Reported-by kernel test robot <[email protected]>Reported-by Dan Carpenter <[email protected]>Fixes 23b6d2cbf75f ("nvme: remove redundant timeout argument from nvme_wait_freeze_timeout")Signed-off-by Maurizio Lombardi <[email protected]>---
v2: keep the <= comparison, change the type from unsigned to signed long
drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/nvme/host/core.c +0
-0
drivers/nvme/host/core.c EXPORT_SYMBOL_GPL(nvme_unfreeze); · line 5252
Quoted 8 lines
drivers/nvme/host/core.c +1
-1@@ -5246,7 +5246,7 @@ EXPORT_SYMBOL_GPL(nvme_unfreeze);int nvme_wait_freeze_timeout (struct nvme_ctrl *ctrl) { -unsigned long timeout = ctrl->io_timeout; +long timeout = ctrl->io_timeout;struct nvme_ns *ns;int srcu_idx;
Keith?
Does this one look better to you?
Maurizio
Quoted 5 lines · Maurizio Lombardi
The timeout variable in
nvme_wait_freeze_timeout()is an unsigned type. Checking if it is <= 0 triggers a compiler warning because an unsigned variable can never be negative.Fix this warning by changing the type to long.
Thanks, applied to nvme-7.2.