Merge tag 'dt-fixes-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh...
[firefly-linux-kernel-4.4.55.git] / sound / soc / soc-dapm.c
index cc36caaf6443619cd2ea8b71eee706cf72ec5f68..dcade130157f3433d88ddbf7db7c311c43ea8042 100644 (file)
@@ -1427,7 +1427,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
                power = 0;
                break;
        default:
-               BUG();
+               WARN(1, "Unknown event %d\n", event);
                return;
        }
 
@@ -1460,7 +1460,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;
@@ -2026,7 +2026,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
                level = "Off\n";
                break;
        default:
-               BUG();
+               WARN(1, "Unknown bias_level %d\n", dapm->bias_level);
                level = "Unknown\n";
                break;
        }
@@ -3359,8 +3359,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,
@@ -3368,9 +3369,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;
@@ -3446,7 +3448,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
                break;
 
        default:
-               BUG();
+               WARN(1, "Unknown event %d\n", event);
                return -EINVAL;
        }