[PATCH] env_api: Use #define's, not their hard-coded values

5 views
Skip to first unread message

Christian Storm

unread,
Nov 13, 2022, 5:21:01 AM11/13/22
to efibootg...@googlegroups.com, Christian Storm
From: Christian Storm <christi...@siemens.com>

Hard-coding the ustate values hurts readability and maintainability.
Hence, use their existing #define'd names.
While at it, fix a non-sense comment.

Signed-off-by: Christian Storm <christi...@siemens.com>
---
env/env_api.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/env/env_api.c b/env/env_api.c
index 6ecd24d..173b764 100644
--- a/env/env_api.c
+++ b/env/env_api.c
@@ -144,9 +144,9 @@ uint32_t ebg_env_user_free(ebgenv_t *e)
uint16_t ebg_env_getglobalstate(ebgenv_t *e)
{
BGENV *env;
- int res = 4;
+ int res = USTATE_UNKNOWN;

- /* find all environments with revision 0 */
+ /* Test for rolled-back condition. */
for (int i = 0; i < ENV_NUM_CONFIG_PARTS; i++) {
env = bgenv_open_by_index(i);

@@ -158,10 +158,10 @@ uint16_t ebg_env_getglobalstate(ebgenv_t *e)
* with ustate == USTATE_FAILED */
if (env->data->revision == REVISION_FAILED &&
env->data->ustate == USTATE_FAILED) {
- res = 3;
+ res = USTATE_FAILED;
}
bgenv_close(env);
- if (res == 3) {
+ if (res == USTATE_FAILED) {
return res;
}
}
--
2.38.1

Jan Kiszka

unread,
Nov 15, 2022, 1:37:48 AM11/15/22
to Christian Storm, efibootg...@googlegroups.com
Thanks, applied.

Jan

--
Siemens AG, Technology
Competence Center Embedded Linux

Reply all
Reply to author
Forward
0 new messages