[PATCH 1/1] part: check CONFIG_IS_ENABLED(ENV_SUPPORT)

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Jul 21 17:37:37 CEST 2023


In SPL environment variables may not be enabled.

Suggested-by: Tom Rini <trini at konsulko.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 disk/part.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 3a9315c0ab..6a30335a48 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -468,9 +468,11 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 #endif
 
 	/* If no dev_part_str, use bootdevice environment variable */
-	if (!dev_part_str || !strlen(dev_part_str) ||
-	    !strcmp(dev_part_str, "-"))
-		dev_part_str = env_get("bootdevice");
+	if (CONFIG_IS_ENABLED(ENV_SUPPORT)) {
+		if (!dev_part_str || !strlen(dev_part_str) ||
+		    !strcmp(dev_part_str, "-"))
+			dev_part_str = env_get("bootdevice");
+	}
 
 	/* If still no dev_part_str, it's an error */
 	if (!dev_part_str) {
-- 
2.40.1



More information about the U-Boot mailing list