regulator: check for init_data on registration
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 9 Sep 2008 15:21:18 +0000 (16:21 +0100)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Mon, 13 Oct 2008 20:51:51 +0000 (21:51 +0100)
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>
drivers/regulator/core.c

index 84202ea..65e07b9 100644 (file)
@@ -1691,6 +1691,9 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
            !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);