summaryrefslogtreecommitdiff
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-07 18:38:47 +0100
committerMark Brown <broonie@linaro.org>2013-11-07 19:59:53 +0000
commitbf4edea863c435c302041cf8bb01c8b3ca729449 (patch)
treefd1443d7fa34648d88b248dfee49034e2d8e82e1 /sound/soc/soc-dapm.c
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>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-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,
power_list)->reg;
list_for_each_entry(w, pending, power_list) {
- BUG_ON(reg != w->reg);
+ WARN_ON(reg != w->reg);
w->power = w->new_power;
mask |= w->mask << w->shift;
@@ -3329,8 +3329,9 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
u64 fmt;
int ret;
- BUG_ON(!config);
- BUG_ON(list_empty(&w->sources) || list_empty(&w->sinks));
+ if (WARN_ON(!config) ||
+ WARN_ON(list_empty(&w->sources) || list_empty(&w->sinks)))
+ return -EINVAL;
/* We only support a single source and sink, pick the first */
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,
sink_p = list_first_entry(&w->sinks, struct snd_soc_dapm_path,
list_source);
- BUG_ON(!source_p || !sink_p);
- BUG_ON(!sink_p->source || !source_p->sink);
- BUG_ON(!source_p->source || !sink_p->sink);
+ if (WARN_ON(!source_p || !sink_p) ||
+ WARN_ON(!sink_p->source || !source_p->sink) ||
+ WARN_ON(!source_p->source || !sink_p->sink))
+ return -EINVAL;
source = source_p->source->priv;
sink = sink_p->sink->priv;