regulator: check for init_data on registration

Since it is now mandatory to supply constraints via init_data on device
registration check for that when registering, saving us from oopsing
later on.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 84202ea..65e07b9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1691,6 +1691,9 @@
 	    !regulator_desc->type == REGULATOR_CURRENT)
 		return ERR_PTR(-EINVAL);
 
+	if (!init_data)
+		return ERR_PTR(-EINVAL);
+
 	rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL);
 	if (rdev == NULL)
 		return ERR_PTR(-ENOMEM);