diff options
author | Miklós Márton <martonmiklosqdev@gmail.com> | 2021-07-27 14:56:59 +0200 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2023-05-15 05:33:57 +0000 |
commit | 57f75bbbf481cba53cd719acb25fa2d7c3ae8736 (patch) | |
tree | e9f27e7630e35e1cfb4b26f232f42904458ce021 /ni845x_spi.c | |
parent | 42b6346571e24bcdecee0ed282ff767a95844206 (diff) | |
download | flashrom-57f75bbbf481cba53cd719acb25fa2d7c3ae8736.tar.gz flashrom-57f75bbbf481cba53cd719acb25fa2d7c3ae8736.tar.bz2 flashrom-57f75bbbf481cba53cd719acb25fa2d7c3ae8736.zip |
ni845x_spi: Fix signed - unsigned comparisons
Change-Id: I48ef927aa28433fb0e3b3a1f3fb2e797095e53bd
Signed-off-by: Miklós Márton <martonmiklosqdev@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56637
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'ni845x_spi.c')
-rw-r--r-- | ni845x_spi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ni845x_spi.c b/ni845x_spi.c index 253025f0a..d4ae294c1 100644 --- a/ni845x_spi.c +++ b/ni845x_spi.c @@ -185,7 +185,7 @@ static int ni845x_spi_open(const char *serial, uInt32 *return_handle) device_pid = pid; - if (!serial || strtol(serial, NULL, 16) == serial_as_number) + if (!serial || strtoul(serial, NULL, 16) == serial_as_number) break; if (found_devices_count > 1) { @@ -222,7 +222,7 @@ static int usb8452_spi_set_io_voltage(uint16_t requested_io_voltage_mV, uint16_t *set_io_voltage_mV, enum voltage_coerce_mode coerce_mode) { - int i = 0; + unsigned int i = 0; uint8_t selected_voltage_100mV = 0; uint8_t requested_io_voltage_100mV = 0; @@ -552,9 +552,9 @@ static int ni845x_spi_init(const struct programmer_cfg *cfg) // read the cs parameter (which Chip select should we use) CS_str = extract_programmer_param_str(cfg, "cs"); if (CS_str) { - CS_number = CS_str[0] - '0'; + CS_number = strtoul(CS_str, NULL, 10); free(CS_str); - if (strlen(CS_str) > 1 || CS_number < 0 || 7 < CS_number) { + if (CS_number > 7) { msg_perr("Only CS 0-7 supported\n"); return 1; } |