summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Jorns <ejo@pengutronix.de>2017-11-01 08:27:06 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-11-03 08:51:21 +0100
commit31fd03b3807309ce033ba7285dadeea3bfc4e566 (patch)
treed7132390c57edbc285710ac6eb8fce05e8215be9
parent7bdd225eeb168498939b8d45d83f6b998ee3866f (diff)
downloadbarebox-31fd03b3807309ce033ba7285dadeea3bfc4e566.tar.gz
barebox-31fd03b3807309ce033ba7285dadeea3bfc4e566.tar.xz
commands: nv: call nvvar_print() only if no argument is given
Printing the nv variables (before performing any modification!) is useless and irritating. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--commands/nv.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/commands/nv.c b/commands/nv.c
index 798b1eaa04..2e6d079357 100644
--- a/commands/nv.c
+++ b/commands/nv.c
@@ -44,14 +44,15 @@ static int do_nv(int argc, char *argv[])
}
}
- if (do_save)
- return nvvar_save();
-
- if (argc == optind) {
+ if (argc == 1) {
nvvar_print();
return 0;
}
+ if (do_save) {
+ return nvvar_save();
+ }
+
argc -= optind;
argv += optind;