[PATCH] regulator: wm831x-dcdc: Add missing checks for pdata before use

From: Mark Brown
Date: Mon May 14 2012 - 06:40:44 EST


Signed-off-by: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/regulator/wm831x-dcdc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index d685911..099da11 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -518,7 +518,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
}
dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK;

- if (pdata->dcdc[id])
+ if (pdata && pdata->dcdc[id])
wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data);

config.dev = pdev->dev.parent;
@@ -851,7 +851,8 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
dcdc->desc.enable_mask = 1 << id;

config.dev = pdev->dev.parent;
- config.init_data = pdata->dcdc[id];
+ if (pdata)
+ config.init_data = pdata->dcdc[id];
config.driver_data = dcdc;
config.regmap = wm831x->regmap;

--
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/