mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
realtek_mst_i2c_spi.c: Clean up get_params()
Set the default value for programmer options just before the user-provided parameters are evaluated. The values get overridden if the user specified their own values, else the pre-set values are used. This way, we get rid of these else-blocks. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Ibb43aaa4d70ee0827587288c658f01bcef583ddd Reviewed-on: https://review.coreboot.org/c/flashrom/+/65936 Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Thomas Heijligen <src@posteo.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
parent
e6e4ca5fe4
commit
bde9479dc1
@ -449,6 +449,7 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
|
||||
char *reset_str = NULL, *isp_str = NULL, *brick_str = NULL;
|
||||
int ret = 0;
|
||||
|
||||
*allow_brick = 0; /* Default behaviour is to bail. */
|
||||
brick_str = extract_programmer_param_str("allow_brick");
|
||||
if (brick_str) {
|
||||
if (!strcmp(brick_str, "yes")) {
|
||||
@ -457,11 +458,10 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
|
||||
msg_perr("%s: Incorrect param format, allow_brick=yes.\n", __func__);
|
||||
ret = SPI_GENERIC_ERROR;
|
||||
}
|
||||
} else {
|
||||
*allow_brick = 0; /* Default behaviour is to bail. */
|
||||
}
|
||||
free(brick_str);
|
||||
|
||||
*reset = 0; /* Default behaviour is no MCU reset on tear-down. */
|
||||
reset_str = extract_programmer_param_str("reset_mcu");
|
||||
if (reset_str) {
|
||||
if (reset_str[0] == '1') {
|
||||
@ -472,11 +472,10 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
|
||||
msg_perr("%s: Incorrect param format, reset_mcu=1 or 0.\n", __func__);
|
||||
ret = SPI_GENERIC_ERROR;
|
||||
}
|
||||
} else {
|
||||
*reset = 0; /* Default behaviour is no MCU reset on tear-down. */
|
||||
}
|
||||
free(reset_str);
|
||||
|
||||
*enter_isp = 1; /* Default behaviour is enter ISP on setup. */
|
||||
isp_str = extract_programmer_param_str("enter_isp");
|
||||
if (isp_str) {
|
||||
if (isp_str[0] == '1') {
|
||||
@ -487,8 +486,6 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
|
||||
msg_perr("%s: Incorrect param format, enter_isp=1 or 0.\n", __func__);
|
||||
ret = SPI_GENERIC_ERROR;
|
||||
}
|
||||
} else {
|
||||
*enter_isp = 1; /* Default behaviour is enter ISP on setup. */
|
||||
}
|
||||
free(isp_str);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user