From: xinghuo.chen@foxmail.com
To: linux@roeck-us.net, jdelvare@suse.com
Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
jingfelix@hust.edu.cn, Xinghuo Chen <xinghuo.chen@foxmail.com>
Subject: [PATCH v2] hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe()
Date: Mon, 3 Mar 2025 07:57:33 -0500 [thread overview]
Message-ID: <tencent_9AD8E7683EC29CAC97496B44F3F865BA070A@qq.com> (raw)
From: Xinghuo Chen <xinghuo.chen@foxmail.com>
The devm_memremap() function returns error pointers on error,
it doesn't return NULL.
Fixes: c7cefce03e69 ("hwmon: (xgene) access mailbox as RAM")
Signed-off-by: Xinghuo Chen <xinghuo.chen@foxmail.com>
---
v1 -> v2:
Use IS_ERR_OR_NULL() instead of IS_ERR() as devm_ioremap()
return NULL on error.
Link to v1: https://lore.kernel.org/all/tencent_370DBB5BD8EF699EC030ACA74BCB440FFA0A@qq.com
---
drivers/hwmon/xgene-hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c
index 1e3bd129a922..7087197383c9 100644
--- a/drivers/hwmon/xgene-hwmon.c
+++ b/drivers/hwmon/xgene-hwmon.c
@@ -706,7 +706,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
goto out;
}
- if (!ctx->pcc_comm_addr) {
+ if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) {
dev_err(&pdev->dev,
"Failed to ioremap PCC comm region\n");
rc = -ENOMEM;
--
2.17.1
next reply other threads:[~2025-03-03 13:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 12:57 xinghuo.chen [this message]
2025-03-03 14:04 ` Guenter Roeck
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=tencent_9AD8E7683EC29CAC97496B44F3F865BA070A@qq.com \
--to=xinghuo.chen@foxmail.com \
--cc=jdelvare@suse.com \
--cc=jingfelix@hust.edu.cn \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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®