diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-09-10 15:02:21 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-09-10 15:02:34 +0200 |
commit | 4090e4e367c5479c71f065c97452eb94c8b008bd (patch) | |
tree | 9a39d3386f70cb2181dcc3b130cd3e446a62cafc /src | |
parent | bfc8c4f2fbbe80b2c2d27cece5fa4634dfecbf8e (diff) | |
download | dt-utils-4090e4e367c5479c71f065c97452eb94c8b008bd.tar.gz dt-utils-4090e4e367c5479c71f065c97452eb94c8b008bd.tar.xz |
barebox-state: make state alias work again
Since commit 14617d (barebox-state: fix default, so that it works without
an explicid alias node) aliases no longer work at all. This is because "/state"
cannot be interpreted as an alias. Fix this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/barebox-state.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/barebox-state.c b/src/barebox-state.c index 34b4902..0f017a8 100644 --- a/src/barebox-state.c +++ b/src/barebox-state.c @@ -1950,10 +1950,20 @@ static struct state *state_get(const char *name) of_set_root_node(root); - node = of_find_node_by_path_or_alias(root, name); - if (!node) { - fprintf(stderr, "no such node: %s\n", name); - return ERR_PTR(-ENOENT); + if (name) { + node = of_find_node_by_path_or_alias(root, name); + if (!node) { + fprintf(stderr, "no such node: %s\n", name); + return ERR_PTR(-ENOENT); + } + } else { + node = of_find_node_by_path_or_alias(root, "state"); + if (!node) + node = of_find_node_by_path_or_alias(root, "/state"); + if (!node) { + fprintf(stderr, "Neither /aliases/state nor /state found\n"); + return ERR_PTR(-ENOENT); + } } if (verbose > 1) { @@ -2042,7 +2052,7 @@ int main(int argc, char *argv[]) int do_dump = 0, do_dump_shell = 0, do_initialize = 0; struct state_set_get *sg; struct list_head sg_list; - char *statename = "/state"; + char *statename = NULL; INIT_LIST_HEAD(&sg_list); |