expo: Correct the logic for duplicate-ID detection
authorSimon Glass <sjg@chromium.org>
Mon, 2 Oct 2023 01:13:26 +0000 (19:13 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 11 Oct 2023 19:43:55 +0000 (15:43 -0400)
Update scene_txt_str() to account for the possibility that the passed-in
str_id may be 0

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/scene.c

index 9c4466c..8e5d3aa 100644 (file)
@@ -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),