ni845x_spi: Use unsigned for array indices

Current GCC and Clang warn about another signed/unsigned comparison,
because the result of ARRAY_SIZE() is unsigned by definition. Hence,
make the array index `i` unsigned  and use a separate `ret` variable
to check return values.

Change-Id: I479a28ec6778fa1795aa4a538e4ab753c31543a2
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/407
diff --git a/ni845x_spi.c b/ni845x_spi.c
index 00a9f11..c1dd59c 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -228,7 +228,8 @@
 				      uint16_t *set_io_voltage_mV,
 				      enum voltage_coerce_mode coerce_mode)
 {
-	int i = 0;
+	int32 ret;
+	unsigned int i;
 	uint8_t selected_voltage_100mV = 0;
 	uint8_t requested_io_voltage_100mV = 0;
 
@@ -293,9 +294,9 @@
 	if (set_io_voltage_mV)
 		*set_io_voltage_mV = (selected_voltage_100mV * 100);
 
-	i = ni845xSetIoVoltageLevel(device_handle, selected_voltage_100mV);
-	if (i != 0) {
-		ni845x_report_error("ni845xSetIoVoltageLevel", i);
+	ret = ni845xSetIoVoltageLevel(device_handle, selected_voltage_100mV);
+	if (ret != 0) {
+		ni845x_report_error("ni845xSetIoVoltageLevel", ret);
 		return -1;
 	}
 	return 0;