regulator: max8907: fix use of possibly NULL idata
authorStephen Warren <swarren@nvidia.com>
Thu, 23 Aug 2012 18:19:18 +0000 (12:19 -0600)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 28 Aug 2012 18:00:30 +0000 (11:00 -0700)
commit5fc72f57e62e10d9d8347ae20f13820d811377da
treef47209456bf767af3660bd727a5459fd79274fc2
parentdedae957a41b4f4523199f7a822ee4e5735640b0
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>
drivers/regulator/max8907-regulator.c