[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20221116005123.81140-1-wupeng58@huawei.com>
Date: Wed, 16 Nov 2022 00:51:23 +0000
From: Peng Wu <wupeng58@...wei.com>
To: <zhuyinbo@...ngson.cn>, <arnd@...db.de>,
<loongarch@...ts.linux.dev>
CC: <linux-kernel@...r.kernel.org>, <liwei391@...wei.com>,
Peng Wu <wupeng58@...wei.com>
Subject: [PATCH -next] soc: loongson: Fix an IS_ERR() vs NULL bug in loongson2_guts_probe()
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@...wei.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
Powered by blists - more mailing lists