Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a61f9e31 authored by Lee Jones's avatar Lee Jones Committed by Mark Brown
Browse files

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: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 0475680b
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -771,10 +771,14 @@ static const struct snd_soc_component_driver ux500_msp_component = {
static int ux500_msp_drv_probe(struct platform_device *pdev)
{
	struct ux500_msp_i2s_drvdata *drvdata;
	struct msp_i2s_platform_data *pdata = pdev->dev.platform_data;
	struct device_node *np = pdev->dev.of_node;
	int ret = 0;

	dev_dbg(&pdev->dev, "%s: Enter (pdev->name = %s).\n", __func__,
		pdev->name);
	if (!pdata && !np) {
		dev_err(&pdev->dev, "No platform data or Device Tree found\n");
		return -ENODEV;
	}

	drvdata = devm_kzalloc(&pdev->dev,
				sizeof(struct ux500_msp_i2s_drvdata),