Skip to content

Commit

Permalink
[PATCH] drivers/mfd/sm501.c: fix an off-by-one
Browse files Browse the repository at this point in the history
Fix an off-by-one spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: Vincent Sanders <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
AdrianBunk authored and Linus Torvalds committed Apr 2, 2007
1 parent 10fa115 commit bf703c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mfd/sm501.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit bf703c3

Please sign in to comment.