Skip to content

Commit

Permalink
cpu/cc2538: Cast enum to unsigned int for comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim Nohlgård committed Jun 1, 2016
1 parent 92370e8 commit abca77b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cpu/cc2538/periph/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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]);
Expand All @@ -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]);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit abca77b

Please sign in to comment.