diff --git a/src/drivers/test_ppm/test_ppm.cpp b/src/drivers/test_ppm/test_ppm.cpp index ba1445a36c..f9fc7997fe 100644 --- a/src/drivers/test_ppm/test_ppm.cpp +++ b/src/drivers/test_ppm/test_ppm.cpp @@ -249,23 +249,26 @@ usage() int test_ppm_main(int argc, char *argv[]) { + if (argc < 2) { + test_ppm::usage(); + return -1; + } + const char *verb = argv[1]; unsigned channels = 7; /* * Start/load the driver. - */ - if (!strcmp(verb, "start")) { test_ppm::start(channels); - exit(0); + return 0; } if (!strcmp(verb, "stop")) { test_ppm::stop(); - exit(0); + return 0; } /* @@ -280,11 +283,9 @@ test_ppm_main(int argc, char *argv[]) unsigned value = strtol(argv[3], NULL, 0); test_ppm::set(channel, value); - exit(0); + return 0; } - - test_ppm::usage(); - exit(1); + return -1; }