mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
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. Corresponding to flashrom svn r1614. Signed-off-by: Niklas Söderlund <niso@kth.se> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
parent
d7d423bbc1
commit
ede2fa4d1e
@ -357,14 +357,13 @@ int main(int argc, char *argv[])
|
|||||||
#if CONFIG_PRINT_WIKI == 1
|
#if CONFIG_PRINT_WIKI == 1
|
||||||
if (list_supported_wiki) {
|
if (list_supported_wiki) {
|
||||||
print_supported_wiki();
|
print_supported_wiki();
|
||||||
ret = 0;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (list_supported) {
|
if (list_supported) {
|
||||||
print_supported();
|
if (print_supported())
|
||||||
ret = 0;
|
ret = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
flash.h
2
flash.h
@ -214,7 +214,7 @@ void chip_readn(const struct flashctx *flash, uint8_t *buf, const chipaddr addr,
|
|||||||
|
|
||||||
/* print.c */
|
/* print.c */
|
||||||
char *flashbuses_to_text(enum chipbustype bustype);
|
char *flashbuses_to_text(enum chipbustype bustype);
|
||||||
void print_supported(void);
|
int print_supported(void);
|
||||||
void print_supported_wiki(void);
|
void print_supported_wiki(void);
|
||||||
|
|
||||||
/* flashrom.c */
|
/* flashrom.c */
|
||||||
|
14
print.c
14
print.c
@ -58,7 +58,7 @@ char *flashbuses_to_text(enum chipbustype bustype)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_supported_chips(void)
|
static int print_supported_chips(void)
|
||||||
{
|
{
|
||||||
const char *delim = "/";
|
const char *delim = "/";
|
||||||
const int mintoklen = 5;
|
const int mintoklen = 5;
|
||||||
@ -182,7 +182,7 @@ static void print_supported_chips(void)
|
|||||||
tmpven = malloc(strlen(chip->vendor) + 1);
|
tmpven = malloc(strlen(chip->vendor) + 1);
|
||||||
if (tmpven == NULL) {
|
if (tmpven == NULL) {
|
||||||
msg_gerr("Out of memory!\n");
|
msg_gerr("Out of memory!\n");
|
||||||
exit(1);
|
return 1;
|
||||||
}
|
}
|
||||||
strcpy(tmpven, chip->vendor);
|
strcpy(tmpven, chip->vendor);
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ static void print_supported_chips(void)
|
|||||||
tmpdev = malloc(strlen(chip->name) + 1);
|
tmpdev = malloc(strlen(chip->name) + 1);
|
||||||
if (tmpdev == NULL) {
|
if (tmpdev == NULL) {
|
||||||
msg_gerr("Out of memory!\n");
|
msg_gerr("Out of memory!\n");
|
||||||
exit(1);
|
return 1;
|
||||||
}
|
}
|
||||||
strcpy(tmpdev, chip->name);
|
strcpy(tmpdev, chip->name);
|
||||||
|
|
||||||
@ -320,6 +320,8 @@ static void print_supported_chips(void)
|
|||||||
}
|
}
|
||||||
msg_ginfo("\n");
|
msg_ginfo("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_INTERNAL == 1
|
#if CONFIG_INTERNAL == 1
|
||||||
@ -431,9 +433,10 @@ static void print_supported_boards_helper(const struct board_info *boards,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void print_supported(void)
|
int print_supported(void)
|
||||||
{
|
{
|
||||||
print_supported_chips();
|
if (print_supported_chips())
|
||||||
|
return 1;
|
||||||
|
|
||||||
msg_ginfo("\nSupported programmers:\n");
|
msg_ginfo("\nSupported programmers:\n");
|
||||||
list_programmers_linebreak(0, 80, 0);
|
list_programmers_linebreak(0, 80, 0);
|
||||||
@ -547,6 +550,7 @@ void print_supported(void)
|
|||||||
programmer_table[PROGRAMMER_LINUX_SPI].name);
|
programmer_table[PROGRAMMER_LINUX_SPI].name);
|
||||||
msg_ginfo("Device files /dev/spidev*.*\n");
|
msg_ginfo("Device files /dev/spidev*.*\n");
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_INTERNAL == 1
|
#if CONFIG_INTERNAL == 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user