summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/mc13783-regulator.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-29 09:01:40 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-03-11 21:48:44 +0100
commit0757b6020f5aaa9f770068ca0396c0ea5cb0740d (patch)
treed966940e0e507f7caba5db286d41d901b9b4da62 /drivers/regulator/mc13783-regulator.c
parentregulator: Convert ab8499 to use get_voltage_sel() (diff)
downloadlinux-0757b6020f5aaa9f770068ca0396c0ea5cb0740d.tar.xz
linux-0757b6020f5aaa9f770068ca0396c0ea5cb0740d.zip
regulator: mc13783: bail out without platform data
the platform data pointer is used without checking it. Bail out in the driver instead of crashing the kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/mc13783-regulator.c')
-rw-r--r--drivers/regulator/mc13783-regulator.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index 8e9b90ad88ae..6c0face87ffe 100644
--- a/drivers/regulator/mc13783-regulator.c
+++ b/drivers/regulator/mc13783-regulator.c
@@ -344,6 +344,9 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "%s id %d\n", __func__, pdev->id);
+ if (!pdata)
+ return -EINVAL;
+
priv = devm_kzalloc(&pdev->dev, sizeof(*priv) +
pdata->num_regulators * sizeof(priv->regulators[0]),
GFP_KERNEL);