From: Adrian Bunk Date: Mon, 2 Apr 2007 06:49:38 +0000 (-0700) Subject: [PATCH] drivers/mfd/sm501.c: fix an off-by-one X-Git-Tag: v2.6.21-rc6~34 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=bf703c3f199342da440a30798b6120f391741ffe;p=linux-2.6-omap-h63xx.git [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 --- diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index c707c8ebc1a..b0b4458ae90 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; }