Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4dee4d44 authored by Roel Kluin's avatar Roel Kluin Committed by Liam Girdwood
Browse files

regulator: add check index of wm8350->pmic.pdev[]



Ensure that reg is within the bounds of array wm8350->pmic.pdev[].

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 43c1266c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;