From e69af5e9677b1e5bf2a2432747ecd714aa537f2a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 26 Nov 2011 18:50:58 +0800 Subject: regulator: export of_get_regulator_init_data of_get_regulator_init_data is called in drivers/regulator/fixed.c which could be a module. Export of_get_regulator_init_data to fix below build error: ERROR: "of_get_regulator_init_data" [drivers/regulator/fixed.ko] undefined! make[1]: *** [__modpost] Error 1 make: *** [modules] Error 2 Reported-by: Randy Dunlap Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/of_regulator.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/regulator') diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 76673c784ab..acd7045d160 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -10,6 +10,7 @@ * (at your option) any later version. */ +#include #include #include #include @@ -79,3 +80,4 @@ struct regulator_init_data *of_get_regulator_init_data(struct device *dev) of_get_regulation_constraints(dev->of_node, &init_data); return init_data; } +EXPORT_SYMBOL_GPL(of_get_regulator_init_data); -- cgit v1.2.3 From 4b864af1a370103148e34044670cd9913de5c1be Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 26 Nov 2011 20:19:19 +0800 Subject: regulator: Checking return value of of_get_regulator_init_data of_get_regulator_init_data() may return NULL, thus check the return value to avoid NULL pointer dereference. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/fixed.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/regulator') diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index db90919f99c..2997f11af90 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -64,6 +64,9 @@ struct fixed_voltage_config *of_get_fixed_voltage_config(struct device *dev) return NULL; config->init_data = of_get_regulator_init_data(dev); + if (!config->init_data) + return NULL; + init_data = config->init_data; config->supply_name = init_data->constraints.name; -- cgit v1.2.3 From bc91396b0b0a0d1300e151264b81f010c72a8bbf Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 27 Nov 2011 10:35:08 +0800 Subject: regulator: Staticise of_get_fixed_voltage_config() It is not used outside this driver so no need to make the symbol global. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/fixed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/regulator') diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 2997f11af90..703c26b756d 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -51,7 +51,8 @@ struct fixed_voltage_data { * tree node, returns a pointer to the populated structure of NULL if memory * alloc fails. */ -struct fixed_voltage_config *of_get_fixed_voltage_config(struct device *dev) +static struct fixed_voltage_config * +of_get_fixed_voltage_config(struct device *dev) { struct fixed_voltage_config *config; struct device_node *np = dev->of_node; -- cgit v1.2.3