summaryrefslogtreecommitdiffstats
path: root/realtek_mst_i2c_spi.c
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2022-07-16 11:20:27 +0200
committerAnastasia Klimchuk <aklm@chromium.org>2022-08-14 23:38:12 +0000
commitbcdfcaf9b083ac4ce512c796313bdf1c6a143ff7 (patch)
treedf8b572529a864ed7ef2a69150af217d62451abf /realtek_mst_i2c_spi.c
parentca4608db6fb444752847db3de1b6d467ffdde16f (diff)
downloadflashrom-bcdfcaf9b083ac4ce512c796313bdf1c6a143ff7.tar.gz
flashrom-bcdfcaf9b083ac4ce512c796313bdf1c6a143ff7.tar.bz2
flashrom-bcdfcaf9b083ac4ce512c796313bdf1c6a143ff7.zip
realtek_mst_i2c_spi.c: Use one variable to store raw parameter values
Currently, each programmer parameter has their own temp variable to store their raw value into it. That's not needed since these variables are only used for a short time to do some configuration and stay unused then. Thus, use only one variable for all of them. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: I48502161add9b59d97f5eeb46f5984c075ad924a Reviewed-on: https://review.coreboot.org/c/flashrom/+/65909 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Diffstat (limited to 'realtek_mst_i2c_spi.c')
-rw-r--r--realtek_mst_i2c_spi.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 1aa18cb0a..42ccc415e 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -446,48 +446,48 @@ static const struct spi_master spi_master_i2c_realtek_mst = {
static int get_params(bool *reset, bool *enter_isp, bool *allow_brick)
{
- char *reset_str = NULL, *isp_str = NULL, *brick_str = NULL;
+ char *param_str;
int ret = 0;
*allow_brick = false; /* Default behaviour is to bail. */
- brick_str = extract_programmer_param_str("allow_brick");
- if (brick_str) {
- if (!strcmp(brick_str, "yes")) {
+ param_str = extract_programmer_param_str("allow_brick");
+ if (param_str) {
+ if (!strcmp(param_str, "yes")) {
*allow_brick = true;
} else {
msg_perr("%s: Incorrect param format, allow_brick=yes.\n", __func__);
ret = SPI_GENERIC_ERROR;
}
}
- free(brick_str);
+ free(param_str);
*reset = false; /* 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') {
+ param_str = extract_programmer_param_str("reset_mcu");
+ if (param_str) {
+ if (param_str[0] == '1') {
*reset = true;
- } else if (reset_str[0] == '0') {
+ } else if (param_str[0] == '0') {
*reset = false;
} else {
msg_perr("%s: Incorrect param format, reset_mcu=1 or 0.\n", __func__);
ret = SPI_GENERIC_ERROR;
}
}
- free(reset_str);
+ free(param_str);
*enter_isp = true; /* Default behaviour is enter ISP on setup. */
- isp_str = extract_programmer_param_str("enter_isp");
- if (isp_str) {
- if (isp_str[0] == '1') {
+ param_str = extract_programmer_param_str("enter_isp");
+ if (param_str) {
+ if (param_str[0] == '1') {
*enter_isp = true;
- } else if (isp_str[0] == '0') {
+ } else if (param_str[0] == '0') {
*enter_isp = false;
} else {
msg_perr("%s: Incorrect param format, enter_isp=1 or 0.\n", __func__);
ret = SPI_GENERIC_ERROR;
}
}
- free(isp_str);
+ free(param_str);
return ret;
}