mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
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:
parent
1836d95928
commit
f25234f1c2
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user