linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: hao.wu@intel.com, linux-fpga@vger.kernel.org,
	linux-kernel@vger.kernel.org, mdf@kernel.org, yilun.xu@intel.com
Subject: Re: [PATCH v2] fpga: stratix10-soc: fix NULL vs IS_ERR() checking
Date: Sat, 11 Dec 2021 06:57:51 -0800	[thread overview]
Message-ID: <97789bcc-0e5b-a822-854f-15d0fbe47844@redhat.com> (raw)
In-Reply-To: <20211211145038.31612-1-linmq006@gmail.com>


On 12/11/21 6:50 AM, Miaoqian Lin wrote:
> The stratix10_svc_allocate_memory function does not return NULL. It
> returns ERR_PTR(-ENOMEM). Use IS_ERR check the return value.
>
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>   drivers/fpga/stratix10-soc.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
> index 047fd7f23706..91212bab5871 100644
> --- a/drivers/fpga/stratix10-soc.c
> +++ b/drivers/fpga/stratix10-soc.c
> @@ -213,9 +213,9 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
>   	/* Allocate buffers from the service layer's pool. */
>   	for (i = 0; i < NUM_SVC_BUFS; i++) {
>   		kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE);
> -		if (!kbuf) {
> +		if (IS_ERR(kbuf)) {
>   			s10_free_buffers(mgr);
> -			ret = -ENOMEM;
> +			ret = PTR_ERR(kbuf);

Thanks!

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

>   			goto init_done;
>   		}
>   


  reply	other threads:[~2021-12-11 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-11 13:43 [PATCH] fpga: stratix10-soc: fix NULL vs IS_ERR() checking Miaoqian Lin
2021-12-11 14:05 ` Tom Rix
2021-12-11 14:50   ` [PATCH v2] " Miaoqian Lin
2021-12-11 14:57     ` Tom Rix [this message]
2021-12-13  1:28       ` Xu Yilun
2021-12-13  6:12         ` Wu, Hao
2021-12-13  6:49           ` [PATCH v3] " Miaoqian Lin

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=97789bcc-0e5b-a822-854f-15d0fbe47844@redhat.com \
    --to=trix@redhat.com \
    --cc=hao.wu@intel.com \
    --cc=linmq006@gmail.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).