From: Miaoqian Lin <linmq006@gmail.com>
To: trix@redhat.com
Cc: hao.wu@intel.com, linmq006@gmail.com, linux-fpga@vger.kernel.org,
linux-kernel@vger.kernel.org, mdf@kernel.org, yilun.xu@intel.com
Subject: [PATCH v2] fpga: stratix10-soc: fix NULL vs IS_ERR() checking
Date: Sat, 11 Dec 2021 14:50:38 +0000 [thread overview]
Message-ID: <20211211145038.31612-1-linmq006@gmail.com> (raw)
In-Reply-To: <b1186cd9-c29c-397b-080b-dcfc6b02525f@redhat.com>
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);
goto init_done;
}
--
2.17.1
next prev parent reply other threads:[~2021-12-11 14:50 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 ` Miaoqian Lin [this message]
2021-12-11 14:57 ` [PATCH v2] " Tom Rix
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=20211211145038.31612-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=hao.wu@intel.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=trix@redhat.com \
--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).