Skip to content

Commit

Permalink
CRIS v32: Should index be positive?
Browse files Browse the repository at this point in the history
`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>
  • Loading branch information
Roel Kluin authored and Jesper Nilsson committed Nov 3, 2009
1 parent 1836d95 commit f25234f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions arch/cris/arch-v32/kernel/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/cris/arch-v32/mach-a3/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions arch/cris/arch-v32/mach-fs/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f25234f

Please sign in to comment.