summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2016-09-14 08:30:15 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2016-09-14 08:32:05 +0200
commitd4c997a3016a18033546766e9562baa1344cb981 (patch)
treebe68c0f65f88a0b725d5905f5d61fdbe9134206a
parentfeb64890a302565974abf5178284965e788c698c (diff)
downloaddt-utils-d4c997a3016a18033546766e9562baa1344cb981.tar.gz
barebox-state: make sure state->name is valid
It's used later while setting state variables. Fixes: feb64890a302 ("barebox-state: fall back to /state if there is no alias defined") Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--src/barebox-state.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/barebox-state.c b/src/barebox-state.c
index 64831df..c2c1d32 100644
--- a/src/barebox-state.c
+++ b/src/barebox-state.c
@@ -508,6 +508,8 @@ int main(int argc, char *argv[])
list_for_each_entry(state, &state_list.list, list) {
state->state = state_get(state->name, readonly);
+ if (!state->name)
+ state->name = state->state->name;
if (IS_ERR(state->state)) {
ret = 1;
goto out_unlock;