From: Mark Brown Date: Tue, 9 Sep 2008 15:21:18 +0000 (+0100) Subject: regulator: check for init_data on registration X-Git-Tag: v2.6.28-rc1~577^2~23 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=46fabe1edd44a8893d88d7982f88d01ccf77f0bb;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Liam Girdwood --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 84202eaace5..65e07b941a3 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -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);