mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mol@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
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: <20210531071239.30653-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210531071239.30653-1-a.fatoum@pengutronix.de>

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 <a.fatoum@pengutronix.de>
---
 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 */
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20210531071239.30653-6-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mol@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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