regulator: wm831x-dcdc: Add missing checks for pdata before use
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 14 May 2012 10:37:09 +0000 (11:37 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 14 May 2012 10:41:36 +0000 (11:41 +0100)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/wm831x-dcdc.c

index 8710cfb0c19b5da082a5ce861b93edd1a1b92590..a885911bb5fce9c3adf4640b2e65fbbe97c7bf9b 100644 (file)
@@ -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;
@@ -846,7 +846,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;