ni845x_spi: Use strtoul() to convert serial
The converted serial number is compared to an unsigned long. In theory,
a negative number could match, as it would be implicitly treated as an
unsigned integer. However, this doesn't seem intentional, the number is
expected in hex and why would it be negative. Hence, use strtoul() and
avoid the signed/unsigned comparison. This gets rid of related warnings
by current GCC and Clang.
Change-Id: I70b847d658d52a53afa253a89c87eecca22177fa
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/406
diff --git a/ni845x_spi.c b/ni845x_spi.c
index 21d39a8..00a9f11 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -169,7 +169,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) {