summaryrefslogtreecommitdiffstats
path: root/realtek_mst_i2c_spi.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2020-10-02 12:40:11 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2020-10-02 03:23:27 +0000
commit90ac9872cdd2a7dc254c182cec74d2314a3e9b2f (patch)
treec93829ca66bbae88836755df126aa935f2e89feb /realtek_mst_i2c_spi.c
parent3ba19b3148ebbf25d759bc3684bb936ff88270fb (diff)
downloadflashrom-90ac9872cdd2a7dc254c182cec74d2314a3e9b2f.tar.gz
flashrom-90ac9872cdd2a7dc254c182cec74d2314a3e9b2f.tar.bz2
flashrom-90ac9872cdd2a7dc254c182cec74d2314a3e9b2f.zip
realtek_mst_i2c_spi.c: Fixup get_params() err ctrl flow
Ensure that when bus number and reset params are specified at the same time are both correctly parsed by get_params(). Also renames the goto err cleanup path to make it clear. Change-Id: Icb45b1ab39181b0f1a2dec1cce549d30db984936 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Spotted-by: Shiyu Sun <sshiyu@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/45944 Reviewed-by: Sam McNally <sammc@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'realtek_mst_i2c_spi.c')
-rw-r--r--realtek_mst_i2c_spi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index e975290c4..d1f72273c 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -416,23 +416,22 @@ static int get_params(int *i2c_bus, int *reset)
int bus = (int)strtol(bus_str, &bus_suffix, 10);
if (errno != 0 || bus_str == bus_suffix) {
msg_perr("%s: Could not convert 'bus'.\n", __func__);
- goto get_params_done;
+ goto _get_params_failed;
}
if (bus < 0 || bus > 255) {
msg_perr("%s: Value for 'bus' is out of range(0-255).\n", __func__);
- goto get_params_done;
+ goto _get_params_failed;
}
if (strlen(bus_suffix) > 0) {
msg_perr("%s: Garbage following 'bus' value.\n", __func__);
- goto get_params_done;
+ goto _get_params_failed;
}
msg_pinfo("Using i2c bus %i.\n", bus);
*i2c_bus = bus;
ret = 0;
- goto get_params_done;
} else {
msg_perr("%s: Bus number not specified.\n", __func__);
}
@@ -451,7 +450,7 @@ static int get_params(int *i2c_bus, int *reset)
*reset = 0; /* Default behaviour is no MCU reset on tear-down. */
free(reset_str);
-get_params_done:
+_get_params_failed:
if (bus_str)
free(bus_str);