OMAP: cs should be positive in gpmc_cs_free()

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>
This commit is contained in:
Roel Kluin 2009-11-17 14:39:06 -08:00 committed by Tony Lindgren
parent d32b20fc7d
commit e7fdc6052e

View File

@ -378,7 +378,7 @@ EXPORT_SYMBOL(gpmc_cs_request);
void gpmc_cs_free(int cs) void gpmc_cs_free(int cs)
{ {
spin_lock(&gpmc_mem_lock); 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); printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
BUG(); BUG();
spin_unlock(&gpmc_mem_lock); spin_unlock(&gpmc_mem_lock);