asoc: tegra: WAR: Check AVP id before setting DMA
Shashank Sharma [Fri, 28 Sep 2012 10:59:24 +0000 (15:59 +0530)]
WAR to check souncard data's avp_id before trying to set
DMA address. An invalid avp_id can cause invlaid rtd, causing
panic in control ioctl calls.

Bug 1046249
Bug 1044761
Bug 1049940
Bug 1050152

Change-Id: Ib536220fdb92f8256c777d6fa14b66e47bc6b7be
Signed-off-by: Shashank Sharma <shashanks@nvidia.com>
Reviewed-on: http://git-master/r/134426
(cherry picked from commit 007fd7b1ae101c5be2a3d35ad11e7190862c04ca)
Reviewed-on: http://git-master/r/142493
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Matthew Pedro <mapedro@nvidia.com>
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

sound/soc/tegra/tegra_asoc_utils.c

index 80d22d2..99ba90d 100644 (file)
@@ -133,6 +133,9 @@ static int tegra_set_dma_addr(struct snd_kcontrol *kcontrol,
        struct snd_pcm_substream *substream;
        struct tegra_runtime_data *prtd;
 
+       if (data->avp_device_id < 0)
+               return 0;
+
        data->avp_dma_addr = ucontrol->value.integer.value[0];
 
        rtd = &card->rtd[data->avp_device_id];