Merge remote-tracking branch 'asoc/topic/ab8500' into asoc-next
authorMark Brown <broonie@linaro.org>
Mon, 4 Nov 2013 06:04:13 +0000 (22:04 -0800)
committerMark Brown <broonie@linaro.org>
Mon, 4 Nov 2013 06:04:13 +0000 (22:04 -0800)
1  2 
sound/soc/codecs/ab8500-codec.c

index a0394a8f2257174738555b5cbf3b5901d5d5fd5b,3ef481551740dba7df6aa9f405a8ce7f83bf0ddc..21ae8d4fdbfb3a0242502197386577232048d509
@@@ -1213,18 -1213,13 +1213,18 @@@ static int anc_status_control_put(struc
        struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
        struct device *dev = codec->dev;
        bool apply_fir, apply_iir;
 -      int req, status;
 +      unsigned int req;
 +      int status;
  
        dev_dbg(dev, "%s: Enter.\n", __func__);
  
        mutex_lock(&drvdata->anc_lock);
  
        req = ucontrol->value.integer.value[0];
 +      if (req >= ARRAY_SIZE(enum_anc_state)) {
 +              status = -EINVAL;
 +              goto cleanup;
 +      }
        if (req != ANC_APPLY_FIR_IIR && req != ANC_APPLY_FIR &&
                req != ANC_APPLY_IIR) {
                dev_err(dev, "%s: ERROR: Unsupported status to set '%s'!\n",
@@@ -2300,17 -2295,17 +2300,17 @@@ static int ab8500_codec_set_dai_tdm_slo
        case 0:
                break;
        case 1:
-               slot = find_first_bit((unsigned long *)&tx_mask, 32);
+               slot = ffs(tx_mask);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
                break;
        case 2:
-               slot = find_first_bit((unsigned long *)&tx_mask, 32);
+               slot = ffs(tx_mask);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
-               slot = find_next_bit((unsigned long *)&tx_mask, 32, slot + 1);
+               slot = fls(tx_mask);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
                snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
                break;
        case 0:
                break;
        case 1:
-               slot = find_first_bit((unsigned long *)&rx_mask, 32);
+               slot = ffs(rx_mask);
                snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot),
                                AB8500_MASK_SLOT(slot),
                                AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
                break;
        case 2:
-               slot = find_first_bit((unsigned long *)&rx_mask, 32);
+               slot = ffs(rx_mask);
                snd_soc_update_bits(codec,
                                AB8500_ADSLOTSEL(slot),
                                AB8500_MASK_SLOT(slot),
                                AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
-               slot = find_next_bit((unsigned long *)&rx_mask, 32, slot + 1);
+               slot = fls(rx_mask);
                snd_soc_update_bits(codec,
                                AB8500_ADSLOTSEL(slot),
                                AB8500_MASK_SLOT(slot),
@@@ -2575,6 -2570,8 +2575,8 @@@ static int ab8500_codec_driver_probe(st
        /* Create driver private-data struct */
        drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_codec_drvdata),
                        GFP_KERNEL);
+       if (!drvdata)
+               return -ENOMEM;
        drvdata->sid_status = SID_UNCONFIGURED;
        drvdata->anc_status = ANC_UNCONFIGURED;
        dev_set_drvdata(&pdev->dev, drvdata);