[PATCH v2 22/36] expo: Correct the logic for duplicate-ID detection

Simon Glass sjg at chromium.org
Mon Oct 2 03:13:26 CEST 2023


Update scene_txt_str() to account for the possibility that the passed-in
str_id may be 0

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 boot/scene.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/boot/scene.c b/boot/scene.c
index 9c4466c1a47a..8e5d3aa7dc05 100644
--- a/boot/scene.c
+++ b/boot/scene.c
@@ -176,8 +176,9 @@ int scene_txt_str(struct scene *scn, const char *name, uint id, uint str_id,
 	ret = expo_str(scn->expo, name, str_id, str);
 	if (ret < 0)
 		return log_msg_ret("str", ret);
-	else if (ret != str_id)
+	if (str_id && ret != str_id)
 		return log_msg_ret("id", -EEXIST);
+	str_id = ret;
 
 	ret = scene_obj_add(scn, name, id, SCENEOBJT_TEXT,
 			    sizeof(struct scene_obj_txt),
-- 
2.42.0.582.g8ccd20d70d-goog



More information about the U-Boot mailing list