From: Adrian Bunk Fix an off-by-one spotted by the Coverity checker. Signed-off-by: Adrian Bunk Cc: Ben Dooks Cc: Vincent Sanders Signed-off-by: Andrew Morton --- drivers/mfd/sm501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN drivers/mfd/sm501.c~drivers-mfd-sm501c-fix-an-off-by-one drivers/mfd/sm501.c --- a/drivers/mfd/sm501.c~drivers-mfd-sm501c-fix-an-off-by-one +++ a/drivers/mfd/sm501.c @@ -319,7 +319,7 @@ int sm501_unit_power(struct device *dev, 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; } _