]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - sound/soc/soc-core.c
Merge remote-tracking branch 'asoc/topic/core' into asoc-next
[karo-tx-linux.git] / sound / soc / soc-core.c
index 4eac227978930a8a8e98c4f0823d59454eab34a9..7365afbc5e18a04bec17d11ec85391aae01eafd4 100644 (file)
@@ -1107,6 +1107,10 @@ static int soc_probe_codec(struct snd_soc_card *card,
                                "ASoC: failed to probe CODEC %d\n", ret);
                        goto err_probe;
                }
+               WARN(codec->dapm.idle_bias_off &&
+                       codec->dapm.bias_level != SND_SOC_BIAS_OFF,
+                       "codec %s can not start from non-off bias"
+                       " with idle_bias_off==1\n", codec->name);
        }
 
        /* If the driver didn't set I/O up try regmap */
@@ -3122,9 +3126,12 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
        if (!codec->using_regmap)
                return -EINVAL;
 
-       data = ucontrol->value.bytes.data;
        len = params->num_regs * codec->val_bytes;
 
+       data = kmemdup(ucontrol->value.bytes.data, len, GFP_KERNEL | GFP_DMA);
+       if (!data)
+               return -ENOMEM;
+
        /*
         * If we've got a mask then we need to preserve the register
         * bits.  We shouldn't modify the incoming data so take a
@@ -3137,10 +3144,6 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
 
                val &= params->mask;
 
-               data = kmemdup(data, len, GFP_KERNEL);
-               if (!data)
-                       return -ENOMEM;
-
                switch (codec->val_bytes) {
                case 1:
                        ((u8 *)data)[0] &= ~params->mask;
@@ -3162,8 +3165,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
        ret = regmap_raw_write(codec->control_data, params->base,
                               data, len);
 
-       if (params->mask)
-               kfree(data);
+       kfree(data);
 
        return ret;
 }