aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-08-23 14:19:18 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-28 14:00:30 -0400
commit5fc72f57e62e10d9d8347ae20f13820d811377da (patch)
treef47209456bf767af3660bd727a5459fd79274fc2 /drivers/regulator
parentdedae957a41b4f4523199f7a822ee4e5735640b0 (diff)
regulator: max8907: fix use of possibly NULL idata
If a regulator is not used by a board, it's quite legitimate not to provide platform data or a device tree node to configure it (i.e. regulator_init_data). In that case, during MAX8907 regulator's probe(), the idata variable will be NULL for that regulator. Prevent dereferincing it. If the MBATT regulator's init_data is not specified, or no name was specified in the constraints, the regulator will be named based on the regulator descriptor, so initialize mbatt_rail_name from there. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/max8907-regulator.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
index 3a5104f6eed4..e97af8ef3aea 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -323,7 +323,10 @@ static __devinit int max8907_regulator_probe(struct platform_device *pdev)
323 323
324 switch (pmic->desc[i].id) { 324 switch (pmic->desc[i].id) {
325 case MAX8907_MBATT: 325 case MAX8907_MBATT:
326 mbatt_rail_name = idata->constraints.name; 326 if (idata && idata->constraints.name)
327 mbatt_rail_name = idata->constraints.name;
328 else
329 mbatt_rail_name = pmic->desc[i].name;
327 break; 330 break;
328 case MAX8907_BBAT: 331 case MAX8907_BBAT:
329 case MAX8907_SDBY: 332 case MAX8907_SDBY: