提交 bf703c3f 编写于 作者: A Adrian Bunk 提交者: Linus Torvalds

[PATCH] drivers/mfd/sm501.c: fix an off-by-one

Fix an off-by-one spotted by the Coverity checker.
Signed-off-by: NAdrian Bunk <bunk@stusta.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Vincent Sanders <vince@arm.linux.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 10fa1155
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册