[PATCH] hwmon: fix a NULL vs IS_ERR() check in xgene_hwmon_probe()

From: xinghuo . chen
Date: Sat Mar 01 2025 - 23:09:51 EST


From: Xinghuo Chen <xinghuo.chen@xxxxxxxxxxx>

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

Signed-off-by: Xinghuo Chen <xinghuo.chen@xxxxxxxxxxx>
---
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