Commit 586fb264 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core.c: fixup snd_soc_of_get_dai_link_cpus()

commit 900dedd7 ("ASoC: Introduce snd_soc_of_get_dai_link_cpus")
adds new snd_soc_of_get_dai_link_cpus(), but it is using
"codec" everywhere. It is very strange, and is issue when error case.
It should call cpu instead of codec in error case.
This patch tidyup it.

Fixes: 900dedd7 ("ASoC: Introduce snd_soc_of_get_dai_link_cpus")
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarMartin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/87zgi5p7k1.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent fc34ece4
...@@ -3424,26 +3424,26 @@ int snd_soc_of_get_dai_link_cpus(struct device *dev, ...@@ -3424,26 +3424,26 @@ int snd_soc_of_get_dai_link_cpus(struct device *dev,
struct of_phandle_args args; struct of_phandle_args args;
struct snd_soc_dai_link_component *component; struct snd_soc_dai_link_component *component;
char *name; char *name;
int index, num_codecs, ret; int index, num_cpus, ret;
/* Count the number of CODECs */ /* Count the number of CPUs */
name = "sound-dai"; name = "sound-dai";
num_codecs = of_count_phandle_with_args(of_node, name, num_cpus = of_count_phandle_with_args(of_node, name,
"#sound-dai-cells"); "#sound-dai-cells");
if (num_codecs <= 0) { if (num_cpus <= 0) {
if (num_codecs == -ENOENT) if (num_cpus == -ENOENT)
dev_err(dev, "No 'sound-dai' property\n"); dev_err(dev, "No 'sound-dai' property\n");
else else
dev_err(dev, "Bad phandle in 'sound-dai'\n"); dev_err(dev, "Bad phandle in 'sound-dai'\n");
return num_codecs; return num_cpus;
} }
component = devm_kcalloc(dev, component = devm_kcalloc(dev,
num_codecs, sizeof(*component), num_cpus, sizeof(*component),
GFP_KERNEL); GFP_KERNEL);
if (!component) if (!component)
return -ENOMEM; return -ENOMEM;
dai_link->cpus = component; dai_link->cpus = component;
dai_link->num_cpus = num_codecs; dai_link->num_cpus = num_cpus;
/* Parse the list */ /* Parse the list */
for_each_link_cpus(dai_link, index, component) { for_each_link_cpus(dai_link, index, component) {
...@@ -3459,7 +3459,7 @@ int snd_soc_of_get_dai_link_cpus(struct device *dev, ...@@ -3459,7 +3459,7 @@ int snd_soc_of_get_dai_link_cpus(struct device *dev,
} }
return 0; return 0;
err: err:
snd_soc_of_put_dai_link_codecs(dai_link); snd_soc_of_put_dai_link_cpus(dai_link);
dai_link->cpus = NULL; dai_link->cpus = NULL;
dai_link->num_cpus = 0; dai_link->num_cpus = 0;
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment