aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-04-13 15:25:43 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-15 05:46:17 -0400
commit60884c2767e0d9314a49e1ee7a0661b3464989c1 (patch)
treeb338cecff2eb570ca588facebf3e19f493a8308e /sound/soc/soc-dapm.c
parent7203a62562dc45dcd69339d4553fb85453d6b587 (diff)
ASoC: dapm: release lock on error paths
We added locking here but there were a couple error paths where we forgot to drop the lock before returning. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 589e16b9a483..c92c537d6be8 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2131,7 +2131,7 @@ err:
2131int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, 2131int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
2132 const struct snd_soc_dapm_route *route, int num) 2132 const struct snd_soc_dapm_route *route, int num)
2133{ 2133{
2134 int i, ret; 2134 int i, ret = 0;
2135 2135
2136 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 2136 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
2137 for (i = 0; i < num; i++) { 2137 for (i = 0; i < num; i++) {
@@ -2139,13 +2139,13 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
2139 if (ret < 0) { 2139 if (ret < 0) {
2140 dev_err(dapm->dev, "Failed to add route %s->%s\n", 2140 dev_err(dapm->dev, "Failed to add route %s->%s\n",
2141 route->source, route->sink); 2141 route->source, route->sink);
2142 return ret; 2142 break;
2143 } 2143 }
2144 route++; 2144 route++;
2145 } 2145 }
2146 mutex_unlock(&dapm->card->dapm_mutex); 2146 mutex_unlock(&dapm->card->dapm_mutex);
2147 2147
2148 return 0; 2148 return ret;
2149} 2149}
2150EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes); 2150EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes);
2151 2151
@@ -2849,6 +2849,7 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
2849{ 2849{
2850 struct snd_soc_dapm_widget *w; 2850 struct snd_soc_dapm_widget *w;
2851 int i; 2851 int i;
2852 int ret = 0;
2852 2853
2853 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 2854 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
2854 for (i = 0; i < num; i++) { 2855 for (i = 0; i < num; i++) {
@@ -2857,12 +2858,13 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
2857 dev_err(dapm->dev, 2858 dev_err(dapm->dev,
2858 "ASoC: Failed to create DAPM control %s\n", 2859 "ASoC: Failed to create DAPM control %s\n",
2859 widget->name); 2860 widget->name);
2860 return -ENOMEM; 2861 ret = -ENOMEM;
2862 break;
2861 } 2863 }
2862 widget++; 2864 widget++;
2863 } 2865 }
2864 mutex_unlock(&dapm->card->dapm_mutex); 2866 mutex_unlock(&dapm->card->dapm_mutex);
2865 return 0; 2867 return ret;
2866} 2868}
2867EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); 2869EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls);
2868 2870