From bf703c3f199342da440a30798b6120f391741ffe Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Sun, 1 Apr 2007 23:49:38 -0700 Subject: [PATCH] drivers/mfd/sm501.c: fix an off-by-one 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 Signed-off-by: Linus Torvalds --- drivers/mfd/sm501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mfd/sm501.c') diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index c707c8ebc1a2..b0b4458ae90b 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -319,7 +319,7 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to) 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; } -- cgit v1.2.3