[PATCH v2 01/21] memory: Fix reserve_sdram_region() return value

Sascha Hauer s.hauer at pengutronix.de
Tue Jan 9 08:15:07 PST 2024


__request_sdram_region() returns NULL on failure, so test for this value
and not for an error pointer. Also all callers of reserve_sdram_region()
expect NULL on failure, so return that value in case of failure.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/memory.c b/common/memory.c
index 300320f853..583843cc34 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -229,8 +229,8 @@ struct resource *reserve_sdram_region(const char *name, resource_size_t start,
 	}
 
 	res = __request_sdram_region(name, IORESOURCE_BUSY, start, size);
-	if (IS_ERR(res))
-		return ERR_CAST(res);
+	if (!res)
+		return NULL;
 
 	remap_range((void *)start, size, MAP_UNCACHED);
 
-- 
2.39.2




More information about the barebox mailing list