diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-06-15 16:30:39 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2009-09-22 08:32:35 -0400 |
commit | 4dee4d441d3f90cd8cec10a9eb222d8a4f2fa2a3 (patch) | |
tree | b246cd1f654cee874a055031d84f53bd4c5150bd /drivers | |
parent | 43c1266ce4dc06bfd236cec31e11e9ecd69c0bef (diff) |
regulator: add check index of wm8350->pmic.pdev[]
Ensure that reg is within the bounds of array wm8350->pmic.pdev[].
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/wm8350-regulator.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 17a00b0fafd1..768bd0e5b48b 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -1419,6 +1419,8 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg, | |||
1419 | { | 1419 | { |
1420 | struct platform_device *pdev; | 1420 | struct platform_device *pdev; |
1421 | int ret; | 1421 | int ret; |
1422 | if (reg < 0 || reg >= NUM_WM8350_REGULATORS) | ||
1423 | return -EINVAL; | ||
1422 | 1424 | ||
1423 | if (wm8350->pmic.pdev[reg]) | 1425 | if (wm8350->pmic.pdev[reg]) |
1424 | return -EBUSY; | 1426 | return -EBUSY; |