summaryrefslogtreecommitdiff
path: root/drivers/regulator/88pm800.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/88pm800.c')
-rw-r--r--drivers/regulator/88pm800.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c
index c72fe95..3459f60 100644
--- a/drivers/regulator/88pm800.c
+++ b/drivers/regulator/88pm800.c
@@ -299,10 +299,13 @@ static int pm800_regulator_probe(struct platform_device *pdev)
return -ENODEV;
}
} else if (pdata->num_regulators) {
- /* Check whether num_regulator is valid. */
unsigned int count = 0;
- for (i = 0; pdata->regulators[i]; i++)
- count++;
+
+ /* Check whether num_regulator is valid. */
+ for (i = 0; i < ARRAY_SIZE(pdata->regulators); i++) {
+ if (pdata->regulators[i])
+ count++;
+ }
if (count != pdata->num_regulators)
return -EINVAL;
} else {