summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/ectool/ectool.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/util/ectool/ectool.c b/util/ectool/ectool.c
index be5a899765..bc3d46cd52 100644
--- a/util/ectool/ectool.c
+++ b/util/ectool/ectool.c
@@ -90,6 +90,11 @@ int main(int argc, char *argv[])
{0, 0, 0, 0}
};
+ if (argv[1] == NULL) {
+ print_usage(argv[0]);
+ exit(1);
+ }
+
while ((opt = getopt_long(argc, argv, "vh?Vidqpw:z:",
long_options, &option_index)) != EOF) {
switch (opt) {
@@ -128,6 +133,12 @@ int main(int argc, char *argv[])
}
}
+ if (optind < argc) {
+ fprintf(stderr, "Error: Extra parameter found.\n");
+ print_usage(argv[0]);
+ exit(1);
+ }
+
if (get_ports && get_ec_ports() != 0)
fprintf(stderr, "Cannot get EC ports from /proc/ioports, "
"fallback to default.");