OMAP: cs should be positive in gpmc_cs_free()
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 17 Nov 2009 22:39:06 +0000 (14:39 -0800)
committerTony Lindgren <tony@atomide.com>
Wed, 18 Nov 2009 18:34:33 +0000 (10:34 -0800)
The index `cs' is signed, test whether it is negative before we release
gpmc_cs_mem[cs].

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm/mach-omap2/gpmc.c

index f8657568b1baff51eeb6b950de4b35b6088d47c7..f3c992e29651c1c0520a28eb551717537ea82a93 100644 (file)
@@ -378,7 +378,7 @@ EXPORT_SYMBOL(gpmc_cs_request);
 void gpmc_cs_free(int cs)
 {
        spin_lock(&gpmc_mem_lock);
-       if (cs >= GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
+       if (cs >= GPMC_CS_NUM || cs < 0 || !gpmc_cs_reserved(cs)) {
                printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
                BUG();
                spin_unlock(&gpmc_mem_lock);