[PATCH 3/5] nvme-fabrics: use unsigned int type

Max Gurtovoy mgurtovoy at nvidia.com
Wed Jan 12 03:41:06 PST 2022


On 1/12/2022 8:20 AM, Chaitanya Kulkarni wrote:
> From: Chaitanya Kulkarni <kch at nvidia.com>
>
> Loop variable i will never have a negative value, so use
> unsigned int type instaed of int.
>
> Signed-off-by: Chaitanya Kulkarni <kch at nvidia.com>
> ---
>   drivers/nvme/host/fabrics.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index d38a630ce3dc..90b3474ea276 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -872,7 +872,7 @@ static int nvmf_check_required_opts(struct nvmf_ctrl_options *opts,
>   		unsigned int required_opts)
>   {
>   	if ((opts->mask & required_opts) != required_opts) {
> -		int i;
> +		unsigned int i;
>   
>   		for (i = 0; i < ARRAY_SIZE(opt_tokens); i++) {
>   			if ((opt_tokens[i].token & required_opts) &&

I'm not against this but this means that we should replace the entire 
kernel that uses int inside a for loop.

If we decide to go with this approach - patch 3/5 and 4/5 should be 
squashed.





More information about the Linux-nvme mailing list