mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
Cc:, Ahmad Fatoum <>
Subject: [PATCH 5/6] ARM: <asm/memory.h>: propagate error codes from arm_add_mem_device()
Date: Mon, 31 May 2021 09:12:38 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

barebox_add_memory_bank() can fail if the to-be-added memory region
has been requested before. This can happen most easily on i.MX and
STM32MP1 boards:

 - The /memory node in the device tree requests a region
 - The DDR controller driver requests an overlapping region after
   reading back RAM configuration.

This most often leads to error messages down the road, but it can be
difficult to pinpoint the cause. Propagate the error code from
arm_add_mem_device(), so DDR controller drivers can fail their probe
on error.

Signed-off-by: Ahmad Fatoum <>
 arch/arm/include/asm/memory.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 52114d0c4ef5..2279306179af 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -10,10 +10,10 @@
 #define UL(x) _AC(x, UL)
-static inline void arm_add_mem_device(const char* name, resource_size_t start,
-				    resource_size_t size)
+static inline int arm_add_mem_device(const char* name, resource_size_t start,
+				     resource_size_t size)
-	barebox_add_memory_bank(name, start, size);
+	return barebox_add_memory_bank(name, start, size);
 #endif	/* __ASM_ARM_MEMORY_H */

barebox mailing list

  parent reply	other threads:[~2021-05-31  7:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31  7:12 [PATCH 0/6] memory: fuse overlapping memory banks Ahmad Fatoum
2021-05-31  7:12 ` [PATCH 1/6] common: memory: allocate all memory devices at once Ahmad Fatoum
2021-05-31  7:12 ` [PATCH 2/6] memory: fuse overlapping memory banks Ahmad Fatoum
2021-05-31  7:12 ` [PATCH 3/6] of: propagate errors inside barebox_register_{of, fdt} into initcalls Ahmad Fatoum
2021-05-31  7:12 ` [PATCH 4/6] of: warn about of_add_memory_bank errors Ahmad Fatoum
2021-05-31  7:12 ` Ahmad Fatoum [this message]
2021-05-31  7:12 ` [PATCH 6/6] ARM: report probe error at arm_add_mem_device() callsites on failure Ahmad Fatoum
2021-06-02  6:38 ` [PATCH 0/6] memory: fuse overlapping memory banks Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox