CRIS v32: Should index be positive?

`port' is used as index for writing to pins during
allocation/deallocation. It should be positive.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
This commit is contained in:
Roel Kluin 2009-11-01 14:46:26 +01:00 committed by Jesper Nilsson
parent 1836d95928
commit f25234f1c2
3 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
crisv32_pinmux_init();
if (port > PORTS)
if (port > PORTS || port < 0)
return -EINVAL;
spin_lock_irqsave(&pinmux_lock, flags);
@ -197,7 +197,7 @@ crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
crisv32_pinmux_init();
if (port > PORTS)
if (port > PORTS || port < 0)
return -EINVAL;
spin_lock_irqsave(&pinmux_lock, flags);

View File

@ -242,7 +242,7 @@ crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
crisv32_pinmux_init();
if (port > PORTS)
if (port > PORTS || port < 0)
return -EINVAL;
spin_lock_irqsave(&pinmux_lock, flags);

View File

@ -54,7 +54,7 @@ crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
crisv32_pinmux_init();
if (port > PORTS)
if (port > PORTS || port < 0)
return -EINVAL;
spin_lock_irqsave(&pinmux_lock, flags);
@ -195,7 +195,7 @@ int crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
crisv32_pinmux_init();
if (port > PORTS)
if (port > PORTS || port < 0)
return -EINVAL;
spin_lock_irqsave(&pinmux_lock, flags);