From: Mengdong Lin Date: Fri, 10 Aug 2012 12:11:58 +0000 (+0200) Subject: ALSA : hda - bug fix on checking the supported power states of a codec X-Git-Tag: v3.6-rc3~14^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e037cb4a54e26b5f55f856e0e7445cfcfb2f3d31;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git ALSA : hda - bug fix on checking the supported power states of a codec The return value of snd_hda_param_read() is -1 for an error, otherwise it's the supported power states of a codec. The supported power states is a 32-bit value. Bit 31 will be set to 1 if the codec supports EPSS, thus making "sup" negative. And the bit 28:5 is reserved as "0". So a negative value other than -1 shall be further checked. Please refer to High-Definition spec 7.3.4.12 "Supported Power States", thanks! Signed-off-by: Mengdong Lin Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 88a9c20..629131a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3497,7 +3497,7 @@ static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg { int sup = snd_hda_param_read(codec, fg, AC_PAR_POWER_STATE); - if (sup < 0) + if (sup == -1) return false; if (sup & power_state) return true;