From 90ac9872cdd2a7dc254c182cec74d2314a3e9b2f Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Fri, 2 Oct 2020 12:40:11 +1000 Subject: 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 Spotted-by: Shiyu Sun Reviewed-on: https://review.coreboot.org/c/flashrom/+/45944 Reviewed-by: Sam McNally Tested-by: build bot (Jenkins) --- realtek_mst_i2c_spi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'realtek_mst_i2c_spi.c') 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); -- cgit v1.2.3