Commit 065aa861 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: protect dlc->of_node under mutex

dlc->of_node will be set on snd_soc_get_dlc(), but we want
1) protect it by mutex, 2) set only when successed.
This patch do it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878rc1kerv.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 82770b76
...@@ -3278,8 +3278,6 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_ ...@@ -3278,8 +3278,6 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
struct snd_soc_component *pos; struct snd_soc_component *pos;
int ret = -EPROBE_DEFER; int ret = -EPROBE_DEFER;
dlc->of_node = args->np;
mutex_lock(&client_mutex); mutex_lock(&client_mutex);
for_each_component(pos) { for_each_component(pos) {
struct device_node *component_of_node = soc_component_to_node(pos); struct device_node *component_of_node = soc_component_to_node(pos);
...@@ -3333,6 +3331,10 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_ ...@@ -3333,6 +3331,10 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
break; break;
} }
if (ret == 0)
dlc->of_node = args->np;
mutex_unlock(&client_mutex); mutex_unlock(&client_mutex);
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