ALSA: asihpi - Minor HPI error handling fixes
authorEliot Blennerhassett <eblennerhassett@audioscience.com>
Mon, 5 Jul 2010 20:37:10 +0000 (08:37 +1200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 6 Jul 2010 06:20:21 +0000 (08:20 +0200)
Handle errors in tuner level caching,
Ccorrect error code for aesebu rx status.

Signed-off-by: Eliot Blennerhassett <eblennerhassett@audioscience.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/asihpi/hpicmn.c

index fcd64539d9efa4d6fe6614a2ebcf730f47f15b56..dda4f1c6f65847504a71016b1064d0039c65e8a3 100644 (file)
@@ -353,7 +353,12 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
                        phr->u.c.param1 = pC->u.t.band;
                else if ((phm->u.c.attribute == HPI_TUNER_LEVEL)
                        && (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE))
-                       phr->u.c.param1 = pC->u.t.level;
+                       if (pC->u.t.level == HPI_ERROR_ILLEGAL_CACHE_VALUE) {
+                               phr->u.c.param1 = 0;
+                               phr->error =
+                                       HPI_ERROR_INVALID_CONTROL_ATTRIBUTE;
+                       } else
+                               phr->u.c.param1 = pC->u.t.level;
                else
                        found = 0;
                break;
@@ -397,7 +402,8 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
                        if (pC->u.clk.source_index ==
                                HPI_ERROR_ILLEGAL_CACHE_VALUE) {
                                phr->u.c.param1 = 0;
-                               phr->error = HPI_ERROR_INVALID_OPERATION;
+                               phr->error =
+                                       HPI_ERROR_INVALID_CONTROL_ATTRIBUTE;
                        } else
                                phr->u.c.param1 = pC->u.clk.source_index;
                } else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SAMPLERATE)