In case gpio_request_list_by_name_nodev() in board dmo_get_memcfg()
returns error code, pick a safe default DRAM configuration instead
of bailing out with some sort of hang() or panic(). The BIT(2)|BIT(0)
strap option is the lowest known option of 2 GiB , use that.

Signed-off-by: Marek Vasut <ma...@denx.de>
---
Cc: "NXP i.MX U-Boot Team" <uboot-...@nxp.com>
Cc: Fabio Estevam <feste...@gmail.com>
Cc: Quentin Schulz <quentin.sch...@cherry.de>
Cc: Sean Anderson <sean...@gmail.com>
Cc: Simon Glass <s...@chromium.org>
Cc: Stefano Babic <sba...@denx.de>
Cc: Tom Rini <tr...@konsulko.com>
Cc: u-boot@lists.denx.de
---
NOTE: For v2025.01
---
 board/data_modul/common/common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/data_modul/common/common.c b/board/data_modul/common/common.c
index b5f83908771..9e35dc5d6cb 100644
--- a/board/data_modul/common/common.c
+++ b/board/data_modul/common/common.c
@@ -47,6 +47,9 @@ u8 dmo_get_memcfg(void)
                                              "dmo,ram-coding-gpios",
                                              gpio, ARRAY_SIZE(gpio),
                                              GPIOD_IS_IN);
+       if (ret < 0)
+               return BIT(2) | BIT(0);
+
        for (i = 0; i < ret; i++)
                memcfg |= !!dm_gpio_get_value(&(gpio[i])) << i;
 
-- 
2.45.2

Reply via email to