[PATCH V2] nvme-core: fix unsigned comparison warning in nvme_wait_freeze_timeout

Maurizio Lombardi mlombard at arkamax.eu
Wed May 27 06:43:08 PDT 2026


On Thu May 21, 2026 at 5:37 PM CEST, Maurizio Lombardi wrote:
> 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 <lkp at intel.com>
> Reported-by: Dan Carpenter <error27 at gmail.com>
> Closes: https://lore.kernel.org/r/202605211257.STzj2Ujv-lkp@intel.com/
> Fixes: 23b6d2cbf75f ("nvme: remove redundant timeout argument from nvme_wait_freeze_timeout")
> Signed-off-by: Maurizio Lombardi <mlombard at redhat.com>
> ---
>
> 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(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 72c50d5e938d..554649ffe430 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -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




More information about the Linux-nvme mailing list