提交 4dee4d44 编写于 作者: R Roel Kluin 提交者: Liam Girdwood

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

Ensure that reg is within the bounds of array wm8350->pmic.pdev[].
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Acked-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: NLiam Girdwood <lrg@slimlogic.co.uk>
上级 43c1266c
...@@ -1419,6 +1419,8 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg, ...@@ -1419,6 +1419,8 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
{ {
struct platform_device *pdev; struct platform_device *pdev;
int ret; int ret;
if (reg < 0 || reg >= NUM_WM8350_REGULATORS)
return -EINVAL;
if (wm8350->pmic.pdev[reg]) if (wm8350->pmic.pdev[reg])
return -EBUSY; return -EBUSY;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册