]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is...
authorAxel Lin <axel.lin@gmail.com>
Thu, 4 Aug 2011 08:18:11 +0000 (16:18 +0800)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 8 Aug 2011 16:15:08 +0000 (17:15 +0100)
In the case of no id is matched, the variable i is equal to
ARRAY_SIZE(pm8607_regulator_info).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/88pm8607.c

index d63fddb0fbb0d5ead8cadb323bfbff49b2a3e00f..e821b2159b4b72a93ef0225d0db2a35b86bc4efa 100644 (file)
@@ -412,7 +412,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
                if (info->desc.id == res->start)
                        break;
        }
-       if ((i < 0) || (i > PM8607_ID_RG_MAX)) {
+       if (i == ARRAY_SIZE(pm8607_regulator_info)) {
                dev_err(&pdev->dev, "Failed to find regulator %llu\n",
                        (unsigned long long)res->start);
                return -EINVAL;