Skip to contentSkip to conversation

arm64: imx8mp: Gracefully handle disabled ENV_IS_IN_SPI_FLASH

PATCH In review Marek Vasut 2 participants 3 messages Mar 19, 2025 – Mar 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: imx8mp: Gracefully handle disabled ENV_IS_IN_SPI_FLASH

In case ENV_IS_IN_SPI_FLASH is disabled, returning ENVL_SPI_FLASH leads to failure to find environment driver on start up. Fix this by testing whether ENV_IS_IN_SPI_FLASH is enabled and if not, then return ENVL_NOWHERE instead.

---
Cc: Christoph Niedermaier <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c +3 -1
index 4af3cbe9fe2..4275436b128 100644
@@ -186,5 +186,7 @@ int board_late_init(void)
 
 enum env_location env_get_location(enum env_operation op, int prio)
 {
-	return prio ? ENVL_UNKNOWN : ENVL_SPI_FLASH;
+	return prio ? ENVL_UNKNOWN : CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH,
+						       (ENVL_SPI_FLASH),
+						       (ENVL_NOWHERE));
 }
Signature · 1 line
2.47.2
#1 lore raw
Quoted 21 lines · Marek Vasut

In case ENV_IS_IN_SPI_FLASH is disabled, returning ENVL_SPI_FLASH leads to failure to find environment driver on start up. Fix this by testing whether ENV_IS_IN_SPI_FLASH is enabled and if not, then return ENVL_NOWHERE instead.

---
Cc: Christoph Niedermaier <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c +0 -0
index 4af3cbe9fe2..4275436b128 100644

board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c int board_late_init(void) · line 192

Quoted 8 lines
board/dhelectronics/dh_imx8mp/imx8mp_dhcom_pdk2.c +3 -1
@@ -186,5 +186,7 @@ int board_late_init(void)
 
  enum env_location env_get_location(enum env_operation op, int prio)
  {
-	return prio ? ENVL_UNKNOWN : ENVL_SPI_FLASH;
+	return prio ? ENVL_UNKNOWN : CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH,
+						       (ENVL_SPI_FLASH),
+						       (ENVL_NOWHERE));
  }

+CC Fabio too ... hmmm, get maintainers is acting up a bit today.

reviewer
#2 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

In case ENV_IS_IN_SPI_FLASH is disabled, returning ENVL_SPI_FLASH leads to failure to find environment driver on start up. Fix this by testing whether ENV_IS_IN_SPI_FLASH is enabled and if not, then return ENVL_NOWHERE instead.

Applied to u-boot-imx/next, thanks.