summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorRoel Kluin <roel.kluin@gmail.com>2009-06-16 00:30:39 +0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-09-22 16:32:35 +0400
commit4dee4d441d3f90cd8cec10a9eb222d8a4f2fa2a3 (patch)
treeb246cd1f654cee874a055031d84f53bd4c5150bd /drivers/regulator
parent43c1266ce4dc06bfd236cec31e11e9ecd69c0bef (diff)
downloadlinux-4dee4d441d3f90cd8cec10a9eb222d8a4f2fa2a3.tar.xz
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/regulator')
-rw-r--r--drivers/regulator/wm8350-regulator.c2
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,
{
struct platform_device *pdev;
int ret;
+ if (reg < 0 || reg >= NUM_WM8350_REGULATORS)
+ return -EINVAL;
if (wm8350->pmic.pdev[reg])
return -EBUSY;