diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/ab8500.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 2f4ec0facef1..5670775f6c9b 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -370,6 +370,12 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | |||
370 | } | 370 | } |
371 | pdata = dev_get_platdata(ab8500->dev); | 371 | pdata = dev_get_platdata(ab8500->dev); |
372 | 372 | ||
373 | /* make sure the platform data has the correct size */ | ||
374 | if (pdata->num_regulator != ARRAY_SIZE(ab8500_regulator_info)) { | ||
375 | dev_err(&pdev->dev, "platform configuration error\n"); | ||
376 | return -EINVAL; | ||
377 | } | ||
378 | |||
373 | /* register all regulators */ | 379 | /* register all regulators */ |
374 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { | 380 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { |
375 | struct ab8500_regulator_info *info = NULL; | 381 | struct ab8500_regulator_info *info = NULL; |
@@ -380,7 +386,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | |||
380 | info->ab8500 = ab8500; | 386 | info->ab8500 = ab8500; |
381 | 387 | ||
382 | info->regulator = regulator_register(&info->desc, &pdev->dev, | 388 | info->regulator = regulator_register(&info->desc, &pdev->dev, |
383 | pdata->regulator[i], info); | 389 | &pdata->regulator[i], info); |
384 | if (IS_ERR(info->regulator)) { | 390 | if (IS_ERR(info->regulator)) { |
385 | err = PTR_ERR(info->regulator); | 391 | err = PTR_ERR(info->regulator); |
386 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 392 | dev_err(&pdev->dev, "failed to register regulator %s\n", |