Skip to contentSkip to conversation

regulator: Checking return value of of_get_regulator_init_data

PATCH Applied Axel Lin 2 participants 2 messages Nov 26, 2011 – Nov 27, 2011 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/regulator/fixed.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/regulator/fixed.c +3 -0
index 716ea37..639e19d 100644
@@ -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;
Signature · 1 line
1.7.5.4
Applied
#1 lore raw
Quoted 2 lines · Axel Lin

of_get_regulator_init_data() may return NULL, thus check the return value to avoid NULL pointer dereference.

Applied, thanks.