summaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-10-23 13:06:46 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-10-23 13:06:46 +0000
commit9e663ee97fb54af44eae2fb356a122c7c33fd0b3 (patch)
tree8d94e7c1a9bfb6d05e5a79935724688e1d64638f /print.c
parent9dc1c1e48bd8b50e315329798efcd8154d7f303f (diff)
downloadflashrom-9e663ee97fb54af44eae2fb356a122c7c33fd0b3.zip
flashrom-9e663ee97fb54af44eae2fb356a122c7c33fd0b3.tar.gz
Remove exit calls from print_supported_chips
Propagate the error code using return values instead, but let cli_classic.c still decide the ultimate return value of the process. Also, remove setting the ret value again after print_supported_wiki() - success is the default. Binary file (standard input) matches Corresponding to flashrom svn r1614.
Diffstat (limited to 'print.c')
-rw-r--r--print.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/print.c b/print.c
index bca861a..5a27320 100644
--- a/print.c
+++ b/print.c
@@ -58,7 +58,7 @@ char *flashbuses_to_text(enum chipbustype bustype)
return ret;
}
-static void print_supported_chips(void)
+static int print_supported_chips(void)
{
const char *delim = "/";
const int mintoklen = 5;
@@ -182,7 +182,7 @@ static void print_supported_chips(void)
tmpven = malloc(strlen(chip->vendor) + 1);
if (tmpven == NULL) {
msg_gerr("Out of memory!\n");
- exit(1);
+ return 1;
}
strcpy(tmpven, chip->vendor);
@@ -206,7 +206,7 @@ static void print_supported_chips(void)
tmpdev = malloc(strlen(chip->name) + 1);
if (tmpdev == NULL) {
msg_gerr("Out of memory!\n");
- exit(1);
+ return 1;
}
strcpy(tmpdev, chip->name);
@@ -320,6 +320,8 @@ static void print_supported_chips(void)
}
msg_ginfo("\n");
}
+
+ return 0;
}
#if CONFIG_INTERNAL == 1
@@ -431,9 +433,10 @@ static void print_supported_boards_helper(const struct board_info *boards,
}
#endif
-void print_supported(void)
+int print_supported(void)
{
- print_supported_chips();
+ if (print_supported_chips())
+ return 1;
msg_ginfo("\nSupported programmers:\n");
list_programmers_linebreak(0, 80, 0);
@@ -547,6 +550,7 @@ void print_supported(void)
programmer_table[PROGRAMMER_LINUX_SPI].name);
msg_ginfo("Device files /dev/spidev*.*\n");
#endif
+ return 0;
}
#if CONFIG_INTERNAL == 1
OpenPOWER on IntegriCloud