Merge branches 'bkl-removal', 'upstream' and 'upstream-fixes' into for-linus
[cascardo/linux.git] / drivers / regulator / wm8350-regulator.c
index 17a00b0..768bd0e 100644 (file)
@@ -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;