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>
This commit is contained in:
parent
43c1266ce4
commit
4dee4d441d
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue