From: Guenter Roeck <linux@roeck-us.net>
To: xinghuo.chen@foxmail.com, jdelvare@suse.com
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
jingfelix@hust.edu.cn
Subject: Re: [PATCH] hwmon: fix a NULL vs IS_ERR() check in xgene_hwmon_probe()
Date: Sun, 2 Mar 2025 08:25:12 -0800 [thread overview]
Message-ID: <fadb9614-306a-4fcd-9829-bf3e50490707@roeck-us.net> (raw)
In-Reply-To: <tencent_370DBB5BD8EF699EC030ACA74BCB440FFA0A@qq.com>
On 3/1/25 19:43, xinghuo.chen@foxmail.com wrote:
> From: Xinghuo Chen <xinghuo.chen@foxmail.com>
>
> The devm_memremap() function returns error pointers on error,
> it doesn't return NULL.
>
> Signed-off-by: Xinghuo Chen <xinghuo.chen@foxmail.com>
Fixes: c7cefce03e69 ("hwmon: (xgene) access mailbox as RAM")
> ---
> 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..4fe30198bae8 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(ctx->pcc_comm_addr)) {
> dev_err(&pdev->dev,
> "Failed to ioremap PCC comm region\n");
> rc = -ENOMEM;
While it is correct that devm_memremap() returns an ERR_PTR() on error,
devm_ioremap() returns NULL. So this has to be IS_ERR_OR_NULL().
Guenter
prev parent reply other threads:[~2025-03-02 16:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-02 3:43 xinghuo.chen
2025-03-02 16:25 ` Guenter Roeck [this message]
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=fadb9614-306a-4fcd-9829-bf3e50490707@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=jingfelix@hust.edu.cn \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xinghuo.chen@foxmail.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®