From fe9264c98f16503028c6ff413935a0e7cf055faa Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Wed, 29 Jun 2016 10:02:46 +0100 Subject: [PATCH] mraa.c: fix unsigned int comparison by usign UINT_MAX instead of -1 This works since both are essentially 'impossible' values. Signed-off-by: Brendan Le Foll --- src/mraa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mraa.c b/src/mraa.c index 867a45a..62d97ad 100644 --- a/src/mraa.c +++ b/src/mraa.c @@ -294,7 +294,8 @@ mraa_setup_mux_mapped(mraa_pin_t meta) unsigned int mi; mraa_result_t ret; mraa_gpio_context mux_i = NULL; - int last_pin = -1; + // avoids the unsigned comparison and we should never have a pin that is UINT_MAX! + unsigned int last_pin = UINT_MAX; for (mi = 0; mi < meta.mux_total; mi++) {