public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] intel_l3_parity: More helpful output in case of errors
@ 2017-09-05 12:39 Petri Latvala
  2017-09-05 12:56 ` ✗ Fi.CI.BAT: warning for " Patchwork
  2017-09-05 16:16 ` [PATCH i-g-t] " Daniel Vetter
  0 siblings, 2 replies; 6+ messages in thread
From: Petri Latvala @ 2017-09-05 12:39 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky

When no action is specified on the command line, print the usage help
text and exit with failure instead of SIGABRT. Fix some typos on the
usage text.

Keep the abort() call in places where they can only be reached by
expanding the tool and forgetting to handle new parameters, with an
error message printed.

CC: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 tools/intel_l3_parity.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/intel_l3_parity.c b/tools/intel_l3_parity.c
index eb00c50..1a4fae5 100644
--- a/tools/intel_l3_parity.c
+++ b/tools/intel_l3_parity.c
@@ -172,9 +172,9 @@ static void usage(const char *name)
 		"  -l, --list				List the current L3 logs\n"
 		"  -a, --clear-all			Clear all disabled rows\n"
 		"  -e, --enable				Enable row, bank, subbank (undo -d)\n"
-		"  -d, --disable=<row,bank,subbank>	Disable row, bank, subbank (inline arguments are deprecated. Please use -r, -b, -s instead\n"
-		"  -i, --inject				[HSW only] Cause hardware to inject a row errors\n"
-		"  -u, --uninject			[HSW only] Turn off hardware error injectection (undo -i)\n"
+		"  -d, --disable=<row,bank,subbank>	Disable row, bank, subbank (inline arguments are deprecated. Please use -r, -b, -s instead)\n"
+		"  -i, --inject				[HSW only] Cause hardware to inject a row error\n"
+		"  -u, --uninject			[HSW only] Turn off hardware error injection (undo -i)\n"
 		"  -L, --listen				Listen for uevent errors\n",
 		name);
 }
@@ -301,6 +301,7 @@ int main(int argc, char *argv[])
 				action = c;
 				break;
 			default:
+				fprintf(stderr, "Internal error: Unhandled flag %c\n", c);
 				abort();
 		}
 	}
@@ -374,7 +375,12 @@ int main(int argc, char *argv[])
 				break;
 			case 'L':
 				break;
+			case '0':
+				/* No action given */
+				usage(argv[0]);
+				exit(EXIT_FAILURE);
 			default:
+				fprintf(stderr, "Internal error: Unhandled action %d\n", action);
 				abort();
 		}
 	}
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-08  6:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 12:39 [PATCH i-g-t] intel_l3_parity: More helpful output in case of errors Petri Latvala
2017-09-05 12:56 ` ✗ Fi.CI.BAT: warning for " Patchwork
2017-09-05 16:16 ` [PATCH i-g-t] " Daniel Vetter
2017-09-05 17:14   ` Ben Widawsky
2017-09-06  9:31   ` Petri Latvala
2017-09-08  6:57     ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox