aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-12-19 10:55:00 -0500
committerMark Brown <broonie@linaro.org>2014-01-07 10:37:19 -0500
commita61f9e314ad8ab9434ddd989b857ed93fdc725e2 (patch)
treec1f0a8337859d772a55d9319aaf94e1eba182ae5
parent0475680b5c2ef4bbdc3af1f6cfd014ea08c8d981 (diff)
ASoC: ux500: Provide better checking for Device Tree and/or Platform Data
These drivers will not work without platform specific data, which is passed in via Device Tree or Platform Data. To avoid the chance of NULL pointer dereferencing and alike, let's ensure we have at least one of the methods in play before continuing. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index c6fb5cce980e..bc042cce115f 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -771,10 +771,14 @@ static const struct snd_soc_component_driver ux500_msp_component = {
771static int ux500_msp_drv_probe(struct platform_device *pdev) 771static int ux500_msp_drv_probe(struct platform_device *pdev)
772{ 772{
773 struct ux500_msp_i2s_drvdata *drvdata; 773 struct ux500_msp_i2s_drvdata *drvdata;
774 struct msp_i2s_platform_data *pdata = pdev->dev.platform_data;
775 struct device_node *np = pdev->dev.of_node;
774 int ret = 0; 776 int ret = 0;
775 777
776 dev_dbg(&pdev->dev, "%s: Enter (pdev->name = %s).\n", __func__, 778 if (!pdata && !np) {
777 pdev->name); 779 dev_err(&pdev->dev, "No platform data or Device Tree found\n");
780 return -ENODEV;
781 }
778 782
779 drvdata = devm_kzalloc(&pdev->dev, 783 drvdata = devm_kzalloc(&pdev->dev,
780 sizeof(struct ux500_msp_i2s_drvdata), 784 sizeof(struct ux500_msp_i2s_drvdata),