Unverified Commit 7871c9f7 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15378 ASoC: atmel: Fix error handling in snd_proto_probe

parents 97b2e4ba c0ad3439
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -115,7 +115,8 @@ static int snd_proto_probe(struct platform_device *pdev)
	cpu_np = of_parse_phandle(np, "i2s-controller", 0);
	if (!cpu_np) {
		dev_err(&pdev->dev, "i2s-controller missing\n");
		return -EINVAL;
		ret = -EINVAL;
		goto put_codec_node;
	}
	dai->cpus->of_node = cpu_np;
	dai->platforms->of_node = cpu_np;
@@ -124,7 +125,8 @@ static int snd_proto_probe(struct platform_device *pdev)
					  &bitclkmaster, &framemaster);
	if (bitclkmaster != framemaster) {
		dev_err(&pdev->dev, "Must be the same bitclock and frame master\n");
		return -EINVAL;
		ret = -EINVAL;
		goto put_cpu_node;
	}
	if (bitclkmaster) {
		dai_fmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
@@ -133,18 +135,21 @@ static int snd_proto_probe(struct platform_device *pdev)
		else
			dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
	}
	of_node_put(bitclkmaster);
	of_node_put(framemaster);
	dai->dai_fmt = dai_fmt;

	of_node_put(codec_np);
	of_node_put(cpu_np);

	dai->dai_fmt = dai_fmt;
	ret = snd_soc_register_card(&snd_proto);
	if (ret && ret != -EPROBE_DEFER)
		dev_err(&pdev->dev,
			"snd_soc_register_card() failed: %d\n", ret);


put_cpu_node:
	of_node_put(bitclkmaster);
	of_node_put(framemaster);
	of_node_put(cpu_np);
put_codec_node:
	of_node_put(codec_np);
	return ret;
}