This patch fixes an off-by-one spotted by the Coverity checker. Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>
--- --- linux-2.6.21-rc3-mm2/drivers/mfd/sm501.c.old 2007-03-19 09:09:57.000000000 +0100 +++ linux-2.6.21-rc3-mm2/drivers/mfd/sm501.c 2007-03-19 09:15:12.000000000 +0100 @@ -314,17 +314,17 @@ int sm501_unit_power(struct device *dev, mutex_lock(&sm->clock_lock); mode = readl(sm->regs + SM501_POWER_MODE_CONTROL); gate = readl(sm->regs + SM501_CURRENT_GATE); clock = readl(sm->regs + SM501_CURRENT_CLOCK); mode &= 3; /* get current power mode */ - if (unit > ARRAY_SIZE(sm->unit_power)) { + if (unit >= ARRAY_SIZE(sm->unit_power)) { dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit); goto already; } dev_dbg(sm->dev, "%s: unit %d, cur %d, to %d\n", __FUNCTION__, unit, sm->unit_power[unit], to); if (to == 0 && sm->unit_power[unit] == 0) { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/