Browse Source

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>
Sascha Hauer 13 years ago
parent
commit
0757b6020f
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/regulator/mc13783-regulator.c

+ 3 - 0
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);