ASoC: core - fix module reference counting for CPU DAIs
PATCH 1/1 ASoC: core - fix module reference counting for CPU DAIs
Currently CODEC and platform drivers have their module reference count incremented soc_probe_dai_link() whilst CPU DAI drivers have their reference count incremented in soc_bind_dai_link().
CPU DAIs should have their reference count incremented in soc_probe_dai_link() just like the CODEC and platform drivers.
--- sound/soc/soc-core.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
sound/soc/soc-core.c +5 -4
@@ -1306,10 +1306,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)/* no, then find CPU DAI from registered DAIs*/ list_for_each_entry (cpu_dai, &dai_list, list) {if (!strcmp (cpu_dai->name, dai_link->cpu_dai_name)) { - -if (!try_module_get (cpu_dai->dev->driver->owner)) -return -ENODEV ; - rtd->cpu_dai = cpu_dai; goto find_codec; }
@@ -1621,12 +1617,17 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num) rtd->pmdown_time = pmdown_time;/* probe the cpu_dai */ +if (!cpu_dai->probed) { +if (!try_module_get (cpu_dai->dev->driver->owner)) +return -ENODEV ; +if (cpu_dai->driver->probe) { ret = cpu_dai->driver->probe (cpu_dai);if (ret <0 ) {printk (KERN_ERR "asoc: failed to probe CPU DAI %s\n" , cpu_dai->name); +module_put (cpu_dai->dev->driver->owner);return ret; } }
Signature · 1 line
1.7.4.1
Quoted 28 lines · Liam
Currently CODEC and platform drivers have their module reference count incremented
soc_probe_dai_link()whilst CPU DAI drivers have their reference count incremented insoc_bind_dai_link().CPU DAIs should have their reference count incremented in
soc_probe_dai_link()just like the CODEC and platform drivers.Signed-off-by Liam Girdwood <[email protected]>--- sound/soc/soc-core.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)sound/soc/soc-core.c +0
-4@@ -1306,10 +1306,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)/* no, then find CPU DAI from registered DAIs*/ list_for_each_entry (cpu_dai, &dai_list, list) {if (!strcmp (cpu_dai->name, dai_link->cpu_dai_name)) { - -if (!try_module_get (cpu_dai->dev->driver->owner)) -return -ENODEV ; - rtd->cpu_dai = cpu_dai; goto find_codec; }
sound/soc/soc-core.c static int soc_probe_dai_link(struct snd_soc_card *card, int num) · line 1620
Quoted 4 lines
sound/soc/soc-core.c +1
-0@@ -1621,12 +1617,17 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num) rtd->pmdown_time = pmdown_time;/* probe the cpu_dai */ +
gah - without the newline.
Quoted 13 lines
sound/soc/soc-core.c +4
-0if (!cpu_dai->probed) { +if (!try_module_get (cpu_dai->dev->driver->owner)) +return -ENODEV ; +if (cpu_dai->driver->probe) { ret = cpu_dai->driver->probe (cpu_dai);if (ret <0 ) {printk (KERN_ERR "asoc: failed to probe CPU DAI %s\n" , cpu_dai->name); +module_put (cpu_dai->dev->driver->owner);return ret; } }
Mark Brown
AppliedQuoted 6 lines · Liam Girdwood
Currently CODEC and platform drivers have their module reference count incremented
soc_probe_dai_link()whilst CPU DAI drivers have their reference count incremented insoc_bind_dai_link().CPU DAIs should have their reference count incremented in
soc_probe_dai_link()just like the CODEC and platform drivers.
Applied, thanks.