The function currently returns NULL for error if the range is in SDRAM and couldn't be requested or an error pointer if the range is outside. Reduce the confusion by using only one way to indicate error. As request_barebox_region is used to replace request_sdram_region calls and that returns NULL on error, follow suit. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/memory.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/memory.c b/common/memory.c index eb7838d03613..c155cb317f25 100644 --- a/common/memory.c +++ b/common/memory.c @@ -84,9 +84,12 @@ struct resource *request_barebox_region(const char *name, resource_size_t end = start + size - 1; if (barebox_res && barebox_res->start <= start && - end <= barebox_res->end) - return __request_region(barebox_res, start, end, - name, IORESOURCE_MEM); + end <= barebox_res->end) { + struct resource *iores; + iores = __request_region(barebox_res, start, end, + name, IORESOURCE_MEM); + return !IS_ERR(iores) ? iores : NULL; + } return request_sdram_region(name, start, size); } -- 2.39.2