From d13b7d659145e74525e85f5615607cce4bd03c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= Date: Wed, 4 Nov 2020 17:33:53 +0100 Subject: [PATCH] intel/tools: allow --color option to be used without arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's already code handling that case and help text also says it's possible. Found, because Coverity complained about optarg NULL check, suggesting optarg can be NULL for other options, where it's not possible. IOW, false positive lead me to finding an unrelated issue. Signed-off-by: Marcin Ĺšlusarz Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/tools/aubinator.c | 2 +- src/intel/tools/aubinator_error_decode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c index 4b4ba48445e..f571370d71a 100644 --- a/src/intel/tools/aubinator.c +++ b/src/intel/tools/aubinator.c @@ -297,7 +297,7 @@ int main(int argc, char *argv[]) { "no-offsets", no_argument, (int *) &option_print_offsets, false }, { "gen", required_argument, NULL, 'g' }, { "headers", no_argument, (int *) &option_full_decode, false }, - { "color", required_argument, NULL, 'c' }, + { "color", optional_argument, NULL, 'c' }, { "xml", required_argument, NULL, 'x' }, { "max-vbo-lines", required_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c index 6a4d42e53c2..6d9ead5338e 100644 --- a/src/intel/tools/aubinator_error_decode.c +++ b/src/intel/tools/aubinator_error_decode.c @@ -759,7 +759,7 @@ main(int argc, char *argv[]) { "no-pager", no_argument, (int *) &pager, false }, { "no-offsets", no_argument, (int *) &option_print_offsets, false }, { "headers", no_argument, (int *) &option_full_decode, false }, - { "color", required_argument, NULL, 'c' }, + { "color", optional_argument, NULL, 'c' }, { "xml", required_argument, NULL, 'x' }, { "all-bb", no_argument, (int *) &option_print_all_bb, true }, { NULL, 0, NULL, 0 }