[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1330502500-30567-1-git-send-email-s.hauer@pengutronix.de>
Date: Wed, 29 Feb 2012 09:01:40 +0100
From: Sascha Hauer <s.hauer@...gutronix.de>
To: linux-kernel@...r.kernel.org
Cc: <linux-arm-kernel@...ts.infradead.org>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Liam Girdwood <lrg@...com>,
Sascha Hauer <s.hauer@...gutronix.de>
Subject: [PATCH] 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@...gutronix.de>
---
drivers/regulator/mc13783-regulator.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
index 8e9b90a..6c0face 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);
--
1.7.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists