From: Wang Ming <machel@vivo.com>
To: Dinh Nguyen <dinguyen@kernel.org>, Alan Tull <atull@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Richard Gong <richard.gong@intel.com>,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com, Wang Ming <machel@vivo.com>
Subject: [PATCH v2] firmware: Fix an NULL vs IS_ERR() bug in probe
Date: Sun, 16 Jul 2023 09:52:57 +0800 [thread overview]
Message-ID: <20230716015310.12293-1-machel@vivo.com> (raw)
The devm_memremap() function returns error pointers.
It never returns NULL. Fix the check.
Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
Signed-off-by: Wang Ming <machel@vivo.com>
---
drivers/firmware/stratix10-svc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 2d674126160f..935bc0cf913f 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -756,7 +756,8 @@ svc_create_memory_pool(struct platform_device *pdev,
paddr = begin;
size = end - begin;
va = devm_memremap(dev, paddr, size, MEMREMAP_WC);
- if (!va) {
+
+ if (IS_ERR(va)) {
dev_err(dev, "fail to remap shared memory\n");
return ERR_PTR(-EINVAL);
}
--
2.25.1
next reply other threads:[~2023-07-16 1:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-16 1:52 Wang Ming [this message]
2023-07-16 5:44 ` Greg Kroah-Hartman
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=20230716015310.12293-1-machel@vivo.com \
--to=machel@vivo.com \
--cc=atull@kernel.org \
--cc=dinguyen@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=richard.gong@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
all inboxes | Powered by JetHome®