mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Wu <wupeng58@huawei.com>
To: <zhuyinbo@loongson.cn>, <arnd@arndb.de>, <loongarch@lists.linux.dev>
Cc: <linux-kernel@vger.kernel.org>, <liwei391@huawei.com>,
	Peng Wu <wupeng58@huawei.com>
Subject: [PATCH -next] soc: loongson: Fix an IS_ERR() vs NULL bug in loongson2_guts_probe()
Date: Wed, 16 Nov 2022 00:51:23 +0000	[thread overview]
Message-ID: <20221116005123.81140-1-wupeng58@huawei.com> (raw)

The ioremap() function returns NULL on error, it doesn't return
error pointers.

Fixes: b82621ac8450 ("soc: loongson: add GUTS driver for loongson-2 platforms")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
 drivers/soc/loongson/loongson2_guts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c
index bace4bc8e03b..52c222b1e6ef 100644
--- a/drivers/soc/loongson/loongson2_guts.c
+++ b/drivers/soc/loongson/loongson2_guts.c
@@ -108,8 +108,8 @@ static int loongson2_guts_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	guts->regs = ioremap(res->start, res->end - res->start + 1);
-	if (IS_ERR(guts->regs))
-		return PTR_ERR(guts->regs);
+	if (!guts->regs)
+		return -ENOMEM;
 
 	/* Register soc device */
 	root = of_find_node_by_path("/");
-- 
2.17.1


                 reply	other threads:[~2022-11-16  0:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221116005123.81140-1-wupeng58@huawei.com \
    --to=wupeng58@huawei.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=loongarch@lists.linux.dev \
    --cc=zhuyinbo@loongson.cn \
    /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®