From abca77beb0ab748e7a3878654e09f16e05d8526e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= <joakim.nohlgard@eistec.se>
Date: Wed, 1 Jun 2016 16:39:55 +0200
Subject: [PATCH] cpu/cc2538: Cast enum to unsigned int for comparison

---
 cpu/cc2538/periph/spi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cpu/cc2538/periph/spi.c b/cpu/cc2538/periph/spi.c
index a8d32efc1d..daf5ce983d 100644
--- a/cpu/cc2538/periph/spi.c
+++ b/cpu/cc2538/periph/spi.c
@@ -55,7 +55,7 @@ int spi_init_master(spi_t dev, spi_conf_t conf, spi_speed_t speed)
 {
     cc2538_ssi_t* ssi = spi_config[dev].dev;
 
-    if (dev >= SPI_NUMOF) {
+    if ((unsigned int)dev >= SPI_NUMOF) {
         return -1;
     }
 
@@ -160,7 +160,7 @@ int spi_init_slave(spi_t dev, spi_conf_t conf, char(*cb)(char data))
 
 int spi_conf_pins(spi_t dev)
 {
-    if (dev >= SPI_NUMOF) {
+    if ((unsigned int)dev >= SPI_NUMOF) {
         return -1;
     }
 
@@ -197,7 +197,7 @@ int spi_conf_pins(spi_t dev)
 
 int spi_acquire(spi_t dev)
 {
-    if (dev >= SPI_NUMOF) {
+    if ((unsigned int)dev >= SPI_NUMOF) {
         return -1;
     }
     mutex_lock(&locks[dev]);
@@ -206,7 +206,7 @@ int spi_acquire(spi_t dev)
 
 int spi_release(spi_t dev)
 {
-    if (dev >= SPI_NUMOF) {
+    if ((unsigned int)dev >= SPI_NUMOF) {
         return -1;
     }
     mutex_unlock(&locks[dev]);
@@ -251,7 +251,7 @@ int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length)
     cc2538_ssi_t* ssi = spi_config[dev].dev;
     typeof(length) tx_n = 0, rx_n = 0;
 
-    if (dev >= SPI_NUMOF) {
+    if ((unsigned int)dev >= SPI_NUMOF) {
         return -1;
     }
 
-- 
GitLab