Skip to contentSkip to conversation

hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe()

PATCH Applied [email protected] 2 participants 2 messages Mar 3, 2025 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe()

From: Xinghuo Chen <[email protected]>

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

Fixes c7cefce03e69 ("hwmon: (xgene) access mailbox as RAM")

---
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/[email protected]

---
 drivers/hwmon/xgene-hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/xgene-hwmon.c +1 -1
index 1e3bd129a922..7087197383c9 100644
@@ -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;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 7 lines · On Mon, Mar 03, 2025 at 07:57:33AM -0500, [email protected] wrote:

From: Xinghuo Chen <[email protected]>

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

Fixes c7cefce03e69 ("hwmon: (xgene) access mailbox as RAM")

Applied.

Thanks,
Guenter

Quoted 23 lines

---
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/[email protected]

---
 drivers/hwmon/xgene-hwmon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/xgene-hwmon.c +1 -1
index 1e3bd129a922..7087197383c9 100644
@@ -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;