Thread (3 messages) 3 messages, 3 authors, 2025-07-18

Re: [PATCH net-next] net: airoha: Fix a NULL vs IS_ERR() bug in airoha_npu_run_firmware()

From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: 2025-07-16 07:17:17
Also in: kernel-janitors, linux-arm-kernel, linux-mediatek, lkml

The devm_ioremap_resource() function returns error pointers.  It never
returns NULL.  Update the check to match.
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
quoted hunk ↗ jump to hunk
Fixes: e27dba1951ce ("net: Use of_reserved_mem_region_to_resource{_byname}() for "memory-region"")
Signed-off-by: Dan Carpenter <redacted>
---
 drivers/net/ethernet/airoha/airoha_npu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/airoha/airoha_npu.c b/drivers/net/ethernet/airoha/airoha_npu.c
index 4e8deb87f751..5b0f66e9cdae 100644
--- a/drivers/net/ethernet/airoha/airoha_npu.c
+++ b/drivers/net/ethernet/airoha/airoha_npu.c
@@ -179,8 +179,8 @@ static int airoha_npu_run_firmware(struct device *dev, void __iomem *base,
 	}
 
 	addr = devm_ioremap_resource(dev, res);
-	if (!addr) {
-		ret = -ENOMEM;
+	if (IS_ERR(addr)) {
+		ret = PTR_ERR(addr);
 		goto out;
 	}
 
-- 
2.47.2

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help