Found with -Wmissing-noreturn and -Wunreachable-code-return Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx> --- utils/v4l2-compliance/v4l2-compliance.cpp | 10 +++++----- utils/v4l2-dbg/v4l2-dbg.cpp | 5 ++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index b3a18492..a312f54d 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -247,7 +247,6 @@ static void usage() printf(" -w, --wrapper Use the libv4l2 wrapper library.\n"); #endif printf(" -W, --exit-on-warn Exit on the first warning.\n"); - exit(0); } const char *ok(int res) @@ -482,6 +481,7 @@ static void restoreState() node->reopen(); } +__attribute__((noreturn)) static void signal_handler_interrupt(int signum) { restoreState(); @@ -1544,7 +1544,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - return 0; + exit(0); case OptSetDevice: device = make_devname(optarg, "video", media_bus_info); break; @@ -1669,13 +1669,13 @@ int main(int argc, char **argv) fprintf(stderr, "Option `%s' requires a value\n", argv[optind]); usage(); - return 1; + exit(1); case '?': if (argv[optind]) fprintf(stderr, "Unknown argument `%s'\n", argv[optind]); usage(); - return 1; + exit(1); } } if (optind < argc) { @@ -1684,7 +1684,7 @@ int main(int argc, char **argv) fprintf(stderr, "%s ", argv[optind++]); fprintf(stderr, "\n"); usage(); - return 1; + exit(1); } bool direct = !options[OptUseWrapper]; int fd; diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp index cd387d1d..99c5a726 100644 --- a/utils/v4l2-dbg/v4l2-dbg.cpp +++ b/utils/v4l2-dbg/v4l2-dbg.cpp @@ -187,7 +187,6 @@ static void usage() " Sets step between two registers\n" " --list-symbols List the symbolic register names you can use, if any\n" " --log-status Log the board status in the kernel log [VIDIOC_LOG_STATUS]\n"); - exit(0); } static std::string cap2s(unsigned cap) @@ -429,7 +428,7 @@ int main(int argc, char **argv) if (argc == 1) { usage(); - return 0; + exit(0); } for (i = 0; long_options[i].name; i++) { if (!isalpha(long_options[i].val)) @@ -467,7 +466,7 @@ int main(int argc, char **argv) switch (ch) { case OptHelp: usage(); - return 0; + exit(0); case OptSetDevice: device = optarg; -- 2.25.3