asoc: tegra: fix Coverity issue
Deepak Nibade [Mon, 25 Feb 2013 10:12:35 +0000 (15:12 +0530)]
Fix improper use of negative value
Coverity id : 22291

Bug 1046331

Change-Id: Id572d73731f8f4e4f8ebe9b6e6dec994188f06f7
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/203765
Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>

sound/soc/tegra/tegra_max98090.c

index 25c1c23..5fe247f 100644 (file)
@@ -461,6 +461,8 @@ static int tegra_max98090_startup(struct snd_pcm_substream *substream)
                /*dam configuration*/
                if (!i2s->dam_ch_refcount)
                        i2s->dam_ifc = tegra30_dam_allocate_controller();
+               if (i2s->dam_ifc < 0)
+                       return i2s->dam_ifc;
 
                tegra30_dam_allocate_channel(i2s->dam_ifc, TEGRA30_DAM_CHIN1);
                i2s->dam_ch_refcount++;
@@ -499,6 +501,8 @@ static int tegra_max98090_startup(struct snd_pcm_substream *substream)
                /* allocate a dam for voice call recording */
 
                i2s->call_record_dam_ifc = tegra30_dam_allocate_controller();
+               if (i2s->call_record_dam_ifc < 0)
+                       return i2s->call_record_dam_ifc;
                tegra30_dam_allocate_channel(i2s->call_record_dam_ifc,
                        TEGRA30_DAM_CHIN0_SRC);
                tegra30_dam_allocate_channel(i2s->call_record_dam_ifc,