nvmutil/state: remove unnecessary check

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-24 04:29:31 +00:00
parent 8b8a5635c3
commit 61ee661b88

View File

@@ -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;
}