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

Commit a66ae631 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: mc13783: Ensure we only try to dereference valid of_nodes



Reported-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a5448c88
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -765,12 +765,18 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
			return -ENOSYS;

		ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
		if (ret)
			goto out;
		if (ret) {
			of_node_put(np);
			return ret;
		}

		ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
		if (ret)
			goto out;
		if (ret) {
			of_node_put(np);
			return ret;
		}

		of_node_put(np);
	}

	dev_set_drvdata(&pdev->dev, priv);
@@ -783,8 +789,6 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
		ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783,
			mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async));

out:
	of_node_put(np);
	return ret;
}