Anastasia Klimchuk submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Anastasia Klimchuk: Looks good to me, approved
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>
---
M ni845x_spi.c
1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/ni845x_spi.c b/ni845x_spi.c
index 253025f..d4ae294 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -185,7 +185,7 @@

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 @@
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 @@
// 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;
}

To view, visit change 56637. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I48ef927aa28433fb0e3b3a1f3fb2e797095e53bd
Gerrit-Change-Number: 56637
Gerrit-PatchSet: 9
Gerrit-Owner: Miklós Márton <martonmiklosqdev@gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Miklós Márton <martonmiklosqdev@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged