diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-08-18 22:29:19 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-09-01 07:59:34 -0400 |
commit | 11fa0d1d20c7cc432c77369bc8bbfbc21030e457 (patch) | |
tree | feb81ad0bdf19f5c6b6267bf29d1b9fa558ea974 /drivers/regulator | |
parent | 7112b2dfea4966c58d21b7197c3f099041248e59 (diff) |
regulator: max8998 - fix memory allocation size for max8998->rdev
We only use max8998->rdev[0] .. max8998->rdev[pdata->num_regulators-1],
max8998->rdev[pdata->num_regulators] is not used.
Thus fix the memory allocation size.
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max8998.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index ab67298799f9..fbcb385034a9 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -549,7 +549,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
549 | if (!max8998) | 549 | if (!max8998) |
550 | return -ENOMEM; | 550 | return -ENOMEM; |
551 | 551 | ||
552 | size = sizeof(struct regulator_dev *) * (pdata->num_regulators + 1); | 552 | size = sizeof(struct regulator_dev *) * pdata->num_regulators; |
553 | max8998->rdev = kzalloc(size, GFP_KERNEL); | 553 | max8998->rdev = kzalloc(size, GFP_KERNEL); |
554 | if (!max8998->rdev) { | 554 | if (!max8998->rdev) { |
555 | kfree(max8998); | 555 | kfree(max8998); |
@@ -583,7 +583,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
583 | 583 | ||
584 | return 0; | 584 | return 0; |
585 | err: | 585 | err: |
586 | for (i = 0; i <= max8998->num_regulators; i++) | 586 | for (i = 0; i < max8998->num_regulators; i++) |
587 | if (rdev[i]) | 587 | if (rdev[i]) |
588 | regulator_unregister(rdev[i]); | 588 | regulator_unregister(rdev[i]); |
589 | 589 | ||
@@ -599,7 +599,7 @@ static int __devexit max8998_pmic_remove(struct platform_device *pdev) | |||
599 | struct regulator_dev **rdev = max8998->rdev; | 599 | struct regulator_dev **rdev = max8998->rdev; |
600 | int i; | 600 | int i; |
601 | 601 | ||
602 | for (i = 0; i <= max8998->num_regulators; i++) | 602 | for (i = 0; i < max8998->num_regulators; i++) |
603 | if (rdev[i]) | 603 | if (rdev[i]) |
604 | regulator_unregister(rdev[i]); | 604 | regulator_unregister(rdev[i]); |
605 | 605 | ||