aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-07 12:38:47 -0500
committerMark Brown <broonie@linaro.org>2013-11-07 14:59:53 -0500
commitbf4edea863c435c302041cf8bb01c8b3ca729449 (patch)
treefd1443d7fa34648d88b248dfee49034e2d8e82e1
parent6c452bdac799e5ab94d658ea3517cfd57d832e6e (diff)
ASoC: dapm: Use WARN_ON() instead of BUG_ON()
Leaving BUG_ON() in a core layer like dapm is rather inappropriate as it leads to panic(), even though sanity checks might be still useful for debugging. Instead, Use WARN_ON(), and handle the error cases accordingly. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/soc-dapm.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 974a4ce14239..47dfe17ed4e8 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1444,7 +1444,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
1444 power_list)->reg; 1444 power_list)->reg;
1445 1445
1446 list_for_each_entry(w, pending, power_list) { 1446 list_for_each_entry(w, pending, power_list) {
1447 BUG_ON(reg != w->reg); 1447 WARN_ON(reg != w->reg);
1448 w->power = w->new_power; 1448 w->power = w->new_power;
1449 1449
1450 mask |= w->mask << w->shift; 1450 mask |= w->mask << w->shift;
@@ -3329,8 +3329,9 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3329 u64 fmt; 3329 u64 fmt;
3330 int ret; 3330 int ret;
3331 3331
3332 BUG_ON(!config); 3332 if (WARN_ON(!config) ||
3333 BUG_ON(list_empty(&w->sources) || list_empty(&w->sinks)); 3333 WARN_ON(list_empty(&w->sources) || list_empty(&w->sinks)))
3334 return -EINVAL;
3334 3335
3335 /* We only support a single source and sink, pick the first */ 3336 /* We only support a single source and sink, pick the first */
3336 source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path, 3337 source_p = list_first_entry(&w->sources, struct snd_soc_dapm_path,
@@ -3338,9 +3339,10 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3338 sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path, 3339 sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path,
3339 list_source); 3340 list_source);
3340 3341
3341 BUG_ON(!source_p || !sink_p); 3342 if (WARN_ON(!source_p || !sink_p) ||
3342 BUG_ON(!sink_p->source || !source_p->sink); 3343 WARN_ON(!sink_p->source || !source_p->sink) ||
3343 BUG_ON(!source_p->source || !sink_p->sink); 3344 WARN_ON(!source_p->source || !sink_p->sink))
3345 return -EINVAL;
3344 3346
3345 source = source_p->source->priv; 3347 source = source_p->source->priv;
3346 sink = sink_p->sink->priv; 3348 sink = sink_p->sink->priv;