]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: Only read the state if we have a state file
authorSimon Glass <sjg@chromium.org>
Tue, 26 Sep 2023 14:14:49 +0000 (08:14 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 6 Oct 2023 18:38:13 +0000 (14:38 -0400)
We should not read this unless requested. Make it conditional on the
option being provided.

Add some debugging to show the state being written.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/start.c
arch/sandbox/cpu/state.c

index 8582f05162fa47cab328e1d7d73c72741403905b..2c8a72590b551e8ee60fc1c72a4a81532b916038 100644 (file)
@@ -522,9 +522,11 @@ int sandbox_main(int argc, char *argv[])
                state->ram_buf_fname = NULL;
        }
 
-       ret = sandbox_read_state(state, state->state_fname);
-       if (ret)
-               goto err;
+       if (state->read_state && state->state_fname) {
+               ret = sandbox_read_state(state, state->state_fname);
+               if (ret)
+                       goto err;
+       }
 
        if (state->handle_signals) {
                ret = os_setup_signal_handlers();
index fcc0028ff4a2813f26121a1dbffbf22fc76f8fa0..e38bb248b7ff938a51222966d501f807ecc9c6db 100644 (file)
@@ -521,6 +521,7 @@ int state_uninit(void)
                        printf("Failed to write sandbox state\n");
                        return -1;
                }
+               log_debug("Wrote state to file '%s'\n", state->ram_buf_fname);
        }
 
        /* Delete this at the last moment so as not to upset gdb too much */