[Skiboot] [PATCH 1/2] external: fix exit code in xscom commands
Cédric Le Goater
clg at fr.ibm.com
Thu Mar 31 23:23:48 AEDT 2016
commit 618a201ebf33 ("external: simplify help output in xscom
commands") broke the exit code in some paths.
Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
external/xscom-utils/getscom.c | 10 +++++-----
external/xscom-utils/getsram.c | 10 +++++-----
external/xscom-utils/putscom.c | 10 +++++-----
3 files changed, 15 insertions(+), 15 deletions(-)
Index: skiboot.git/external/xscom-utils/getscom.c
===================================================================
--- skiboot.git.orig/external/xscom-utils/getscom.c
+++ skiboot.git/external/xscom-utils/getscom.c
@@ -23,12 +23,12 @@
#include "xscom.h"
-static void print_usage(void)
+static void print_usage(int code)
{
printf("usage: getscom [-c|--chip chip-id] addr\n");
printf(" getscom -l|--list-chips\n");
printf(" getscom -v|--version\n");
- exit(1);
+ exit(code);
}
static void print_chip_info(uint32_t chip_id)
@@ -102,14 +102,14 @@ int main(int argc, char *argv[])
chip_id = strtoul(optarg, NULL, 0);
break;
case 'h':
- print_usage();
+ print_usage(0);
break;
case 'l':
list_chips = true;
break;
case 'v':
printf("xscom utils version %s\n", VERSION);
- exit(1);
+ exit(0);
default:
exit(1);
}
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
no_work = true;
if (no_work && !list_chips) {
fprintf(stderr, "Invalid or missing address\n");
- print_usage();
+ print_usage(1);
}
def_chip = xscom_init();
Index: skiboot.git/external/xscom-utils/getsram.c
===================================================================
--- skiboot.git.orig/external/xscom-utils/getsram.c
+++ skiboot.git/external/xscom-utils/getsram.c
@@ -24,12 +24,12 @@
#include "xscom.h"
#include "sram.h"
-static void print_usage(void)
+static void print_usage(int code)
{
printf("usage: getsram [-c|--chip chip-id] addr\n");
printf(" [--occ-channel|n <chan>]\n");
printf(" getsram -v|--version\n");
- exit(1);
+ exit(code);
}
int main(int argc, char *argv[])
@@ -66,11 +66,11 @@ int main(int argc, char *argv[])
}
break;
case 'h':
- print_usage();
+ print_usage(0);
break;
case 'v':
printf("xscom utils version %s\n", VERSION);
- exit(1);
+ exit(0);
default:
exit(1);
}
@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
if (addr == -1ull) {
fprintf(stderr, "Invalid or missing address\n");
- print_usage();
+ print_usage(1);
}
def_chip = xscom_init();
Index: skiboot.git/external/xscom-utils/putscom.c
===================================================================
--- skiboot.git.orig/external/xscom-utils/putscom.c
+++ skiboot.git/external/xscom-utils/putscom.c
@@ -23,11 +23,11 @@
#include "xscom.h"
-static void print_usage(void)
+static void print_usage(int code)
{
printf("usage: putscom [-c|--chip chip-id] addr value\n");
printf(" putscom -v|--version\n");
- exit(1);
+ exit(code);
}
int main(int argc, char *argv[])
@@ -63,9 +63,9 @@ int main(int argc, char *argv[])
break;
case 'v':
printf("xscom utils version %s\n", VERSION);
- exit(1);
+ exit(0);
case 'h':
- print_usage();
+ print_usage(0);
break;
default:
exit(1);
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
if (!got_addr || !got_val) {
fprintf(stderr, "Invalid or missing address/value\n");
- print_usage();
+ print_usage(1);
}
def_chip = xscom_init();
More information about the Skiboot
mailing list