aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-11-01 08:46:26 -0500
committerJesper Nilsson <jesper.nilsson@axis.com>2009-11-03 08:11:53 -0500
commitf25234f1c21ad9878bd38719381e13f4ef1990ce (patch)
treecd01c222db18d498223d33225f1acf6cb417626a /arch/cris
parent1836d95928a0f41ada0cbb2a6c4e46b027db9491 (diff)
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>
Diffstat (limited to 'arch/cris')
-rw-r--r--arch/cris/arch-v32/kernel/pinmux.c4
-rw-r--r--arch/cris/arch-v32/mach-a3/pinmux.c2
-rw-r--r--arch/cris/arch-v32/mach-fs/pinmux.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/arch/cris/arch-v32/kernel/pinmux.c b/arch/cris/arch-v32/kernel/pinmux.c
index 6eb54ea1c976..f6f3637a4194 100644
--- a/arch/cris/arch-v32/kernel/pinmux.c
+++ b/arch/cris/arch-v32/kernel/pinmux.c
@@ -54,7 +54,7 @@ crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
54 54
55 crisv32_pinmux_init(); 55 crisv32_pinmux_init();
56 56
57 if (port > PORTS) 57 if (port > PORTS || port < 0)
58 return -EINVAL; 58 return -EINVAL;
59 59
60 spin_lock_irqsave(&pinmux_lock, flags); 60 spin_lock_irqsave(&pinmux_lock, flags);
@@ -197,7 +197,7 @@ crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
197 197
198 crisv32_pinmux_init(); 198 crisv32_pinmux_init();
199 199
200 if (port > PORTS) 200 if (port > PORTS || port < 0)
201 return -EINVAL; 201 return -EINVAL;
202 202
203 spin_lock_irqsave(&pinmux_lock, flags); 203 spin_lock_irqsave(&pinmux_lock, flags);
diff --git a/arch/cris/arch-v32/mach-a3/pinmux.c b/arch/cris/arch-v32/mach-a3/pinmux.c
index 0a28c9bedfb7..18648ef2d874 100644
--- a/arch/cris/arch-v32/mach-a3/pinmux.c
+++ b/arch/cris/arch-v32/mach-a3/pinmux.c
@@ -242,7 +242,7 @@ crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
242 242
243 crisv32_pinmux_init(); 243 crisv32_pinmux_init();
244 244
245 if (port > PORTS) 245 if (port > PORTS || port < 0)
246 return -EINVAL; 246 return -EINVAL;
247 247
248 spin_lock_irqsave(&pinmux_lock, flags); 248 spin_lock_irqsave(&pinmux_lock, flags);
diff --git a/arch/cris/arch-v32/mach-fs/pinmux.c b/arch/cris/arch-v32/mach-fs/pinmux.c
index d722ad9ae626..38f29eec14a6 100644
--- a/arch/cris/arch-v32/mach-fs/pinmux.c
+++ b/arch/cris/arch-v32/mach-fs/pinmux.c
@@ -54,7 +54,7 @@ crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
54 54
55 crisv32_pinmux_init(); 55 crisv32_pinmux_init();
56 56
57 if (port > PORTS) 57 if (port > PORTS || port < 0)
58 return -EINVAL; 58 return -EINVAL;
59 59
60 spin_lock_irqsave(&pinmux_lock, flags); 60 spin_lock_irqsave(&pinmux_lock, flags);
@@ -195,7 +195,7 @@ int crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
195 195
196 crisv32_pinmux_init(); 196 crisv32_pinmux_init();
197 197
198 if (port > PORTS) 198 if (port > PORTS || port < 0)
199 return -EINVAL; 199 return -EINVAL;
200 200
201 spin_lock_irqsave(&pinmux_lock, flags); 201 spin_lock_irqsave(&pinmux_lock, flags);