linux-fpga.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: Marco Pagani <marpagan@redhat.com>,
	Moritz Fischer <mdf@kernel.org>, Wu Hao <hao.wu@intel.com>,
	Xu Yilun <yilun.xu@intel.com>
Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fpga: altera-pr-ip: fix unsigned comparison with less than zero
Date: Wed, 6 Apr 2022 07:18:21 -0700	[thread overview]
Message-ID: <d39cdc4c-0dc5-f929-17fa-ffbaf9e767c7@redhat.com> (raw)
In-Reply-To: <20220405185349.220607-1-marpagan@redhat.com>


On 4/5/22 11:53 AM, Marco Pagani wrote:
> Fix the "comparison with less than zero" warning reported by
> cppcheck for the unsigned (size_t) parameter "count" of the
> "alt_pr_fpga_write()" function.
>
> Signed-off-by: Marco Pagani <marpagan@redhat.com>
> ---
>   drivers/fpga/altera-pr-ip-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-core.c
> index be0667968d33..2ff3d8e46a0c 100644
> --- a/drivers/fpga/altera-pr-ip-core.c
> +++ b/drivers/fpga/altera-pr-ip-core.c
> @@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, const char *buf,
>   	u32 *buffer_32 = (u32 *)buf;
>   	size_t i = 0;
>   
> -	if (count <= 0)
> +	if (count == 0)
>   		return -EINVAL;

Reviewed-by: Tom Rix <trix@redhat.com>

>   
>   	/* Write out the complete 32-bit chunks */


  reply	other threads:[~2022-04-06 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 18:53 [PATCH] fpga: altera-pr-ip: fix unsigned comparison with less than zero Marco Pagani
2022-04-06 14:18 ` Tom Rix [this message]
2022-04-07  2:09   ` Xu Yilun
2022-04-20  4:24 ` Moritz Fischer
2022-04-22 15:47   ` Marco Pagani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d39cdc4c-0dc5-f929-17fa-ffbaf9e767c7@redhat.com \
    --to=trix@redhat.com \
    --cc=hao.wu@intel.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marpagan@redhat.com \
    --cc=mdf@kernel.org \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).