[flashrom] [commit] r1614 - trunk
repository service
svn at flashrom.org
Tue Oct 23 15:06:47 CEST 2012
Author: stefanct
Date: Tue Oct 23 15:06:46 2012
New Revision: 1614
URL: http://flashrom.org/trac/flashrom/changeset/1614
Log:
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.
Signed-off-by: Niklas Söderlund <niso at kth.se>
Acked-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>
Modified:
trunk/cli_classic.c
trunk/flash.h
trunk/print.c
Modified: trunk/cli_classic.c
==============================================================================
--- trunk/cli_classic.c Sat Oct 20 11:13:16 2012 (r1613)
+++ trunk/cli_classic.c Tue Oct 23 15:06:46 2012 (r1614)
@@ -357,14 +357,13 @@
#if CONFIG_PRINT_WIKI == 1
if (list_supported_wiki) {
print_supported_wiki();
- ret = 0;
goto out;
}
#endif
if (list_supported) {
- print_supported();
- ret = 0;
+ if (print_supported())
+ ret = 1;
goto out;
}
Modified: trunk/flash.h
==============================================================================
--- trunk/flash.h Sat Oct 20 11:13:16 2012 (r1613)
+++ trunk/flash.h Tue Oct 23 15:06:46 2012 (r1614)
@@ -214,7 +214,7 @@
/* print.c */
char *flashbuses_to_text(enum chipbustype bustype);
-void print_supported(void);
+int print_supported(void);
void print_supported_wiki(void);
/* flashrom.c */
Modified: trunk/print.c
==============================================================================
--- trunk/print.c Sat Oct 20 11:13:16 2012 (r1613)
+++ trunk/print.c Tue Oct 23 15:06:46 2012 (r1614)
@@ -58,7 +58,7 @@
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 @@
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 @@
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 @@
}
msg_ginfo("\n");
}
+
+ return 0;
}
#if CONFIG_INTERNAL == 1
@@ -431,9 +433,10 @@
}
#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 @@
programmer_table[PROGRAMMER_LINUX_SPI].name);
msg_ginfo("Device files /dev/spidev*.*\n");
#endif
+ return 0;
}
#if CONFIG_INTERNAL == 1
More information about the flashrom
mailing list