From: Axel Lin Date: Sat, 26 Nov 2011 12:19:19 +0000 (+0800) Subject: regulator: Checking return value of of_get_regulator_init_data X-Git-Tag: next-20111128~30^2~1^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4b864af1a370103148e34044670cd9913de5c1be;p=karo-tx-linux.git 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 --- diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index db90919f99c2..2997f11af905 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;