* [PATCH] regulator: Checking return value of of_get_regulator_init_data
@ 2011-11-26 12:19 Axel Lin
2011-11-27 11:30 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-11-26 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Rajendra Nayak, Liam Girdwood, Mark Brown
of_get_regulator_init_data() may return NULL, thus
check the return value to avoid NULL pointer dereference.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/fixed.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 716ea37..639e19d 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;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-27 11:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-26 12:19 [PATCH] regulator: Checking return value of of_get_regulator_init_data Axel Lin
2011-11-27 11:30 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox