Skip to contentSkip to conversation

remoteproc: imx_dsp_rproc: Fix NULL vs IS_ERR() bug in imx_dsp_rproc_add_carveout()

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 27, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: imx_dsp_rproc: Fix NULL vs IS_ERR() bug in imx_dsp_rproc_add_carveout()

The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the error checking to match.

Fixes 67a7bc7f0358 ("remoteproc: Use of_reserved_mem_region_* functions for "memory-region"")
---
 drivers/remoteproc/imx_dsp_rproc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +2 -2
index be83b5f20f15..5130a35214c9 100644
@@ -710,9 +710,9 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
 			return -EINVAL;
 
 		cpu_addr = devm_ioremap_resource_wc(dev, &res);
-		if (!cpu_addr) {
+		if (IS_ERR(cpu_addr)) {
 			dev_err(dev, "failed to map memory %pR\n", &res);
-			return -ENOMEM;
+			return PTR_ERR(cpu_addr);
 		}
 
 		/* Register memory region */
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the error checking to match.

Fixes 67a7bc7f0358 ("remoteproc: Use of_reserved_mem_region_* functions for "memory-region"")

Thanks,
Iulia

Quoted 20 lines
---
  drivers/remoteproc/imx_dsp_rproc.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +2 -2
index be83b5f20f15..5130a35214c9 100644
@@ -710,9 +710,9 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
  			return -EINVAL;
 
  		cpu_addr = devm_ioremap_resource_wc(dev, &res);
-		if (!cpu_addr) {
+		if (IS_ERR(cpu_addr)) {
  			dev_err(dev, "failed to map memory %pR\n", &res);
-			return -ENOMEM;
+			return PTR_ERR(cpu_addr);
  		}
 
  		/* Register memory region */
maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 14 lines · Dan Carpenter

The devm_ioremap_resource_wc() function never returns NULL, it returns error pointers. Update the error checking to match.

Fixes 67a7bc7f0358 ("remoteproc: Use of_reserved_mem_region_* functions for "memory-region"")
---
 drivers/remoteproc/imx_dsp_rproc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/imx_dsp_rproc.c +0 -0
index be83b5f20f15..5130a35214c9 100644

drivers/remoteproc/imx_dsp_rproc.c static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv) · line 715

Quoted 8 lines
drivers/remoteproc/imx_dsp_rproc.c +2 -2
@@ -710,9 +710,9 @@ static int imx_dsp_rproc_add_carveout(struct imx_dsp_rproc *priv)
 			return -EINVAL;
 
 		cpu_addr = devm_ioremap_resource_wc(dev, &res);
-		if (!cpu_addr) {
+		if (IS_ERR(cpu_addr)) {
 			dev_err(dev, "failed to map memory %pR\n", &res);
-			return -ENOMEM;
+			return PTR_ERR(cpu_addr);

Applied.

Thanks,
Mathieu

Quoted 6 lines
drivers/remoteproc/imx_dsp_rproc.c +0 -0
 		}
 
 		/* Register memory region */
Signature · 1 line
2.51.0