* [PATCH] hwmon: fix a NULL vs IS_ERR() check in xgene_hwmon_probe()
@ 2025-03-02 3:43 xinghuo.chen
2025-03-02 16:25 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: xinghuo.chen @ 2025-03-02 3:43 UTC (permalink / raw)
To: jdelvare; +Cc: linux, linux-hwmon, linux-kernel, jingfelix, Xinghuo Chen
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>
---
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;
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] hwmon: fix a NULL vs IS_ERR() check in xgene_hwmon_probe()
2025-03-02 3:43 [PATCH] hwmon: fix a NULL vs IS_ERR() check in xgene_hwmon_probe() xinghuo.chen
@ 2025-03-02 16:25 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2025-03-02 16:25 UTC (permalink / raw)
To: xinghuo.chen, jdelvare; +Cc: linux-hwmon, linux-kernel, jingfelix
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-02 16:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-02 3:43 [PATCH] hwmon: fix a NULL vs IS_ERR() check in xgene_hwmon_probe() xinghuo.chen
2025-03-02 16:25 ` Guenter Roeck
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®