From 61ee661b886508d158702f9925af02464e227c3a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 24 Mar 2026 04:29:31 +0000 Subject: nvmutil/state: remove unnecessary check Signed-off-by: Leah Rowe --- util/libreboot-utils/lib/state.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/util/libreboot-utils/lib/state.c b/util/libreboot-utils/lib/state.c index d06a8869..f9be230f 100644 --- a/util/libreboot-utils/lib/state.c +++ b/util/libreboot-utils/lib/state.c @@ -26,7 +26,6 @@ struct xstate * xstart(int argc, char *argv[]) { static int first_run = 1; - static int pre_init = 0; static struct xstate us = { /* DO NOT MESS THIS UP, OR THERE WILL BE DEMONS */ @@ -89,15 +88,8 @@ xstart(int argc, char *argv[]) }; - if (!first_run) { - if (pre_init) - err_no_cleanup(ECANCELED, - "Outside access to state during init"); - - first_run = 0; - + if (!first_run) return &us; - } if (argc < 3) err_no_cleanup(EINVAL, "xstart: Too few arguments"); @@ -105,15 +97,16 @@ xstart(int argc, char *argv[]) err_no_cleanup(EINVAL, "xstart: NULL argv"); first_run = 0; - pre_init = 1; us.f.buf = us.f.real_buf; us.argv0 = argv[0]; us.f.fname = argv[1]; + us.f.tmp_fd = -1; + us.f.tname = NULL; if (new_tmpfile(&us.f.tmp_fd, &us.f.tname) < 0) - err_no_cleanup(errno, "xstart: cannot create tmpfile"); + err_no_cleanup(errno, "%s", us.f.tname); /* parse user command */ /* TODO: CHECK ACCESSES VIA xstatus() */ @@ -134,8 +127,6 @@ xstart(int argc, char *argv[]) /* for good measure */ memset(us.f.pad, 0, sizeof(us.f.pad)); - pre_init = 0; - return &us; } -- cgit v1.2.1