[alsa-devel] [PATCH] ALSA : hda - bug fix on return value check when getting 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 mengdong.lin@intel.com --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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; -- 1.7.9.5
At Fri, 10 Aug 2012 09:15:51 +0000, Lin, Mengdong wrote:
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 mengdong.lin@intel.com
Could you resend in a normal text? It's garbled badly with HTML in the signature and can't be applied.
Also, try to shorten the subject a bit more.
thanks,
Takashi
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 mengdong.lin@intel.com --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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; -- 1.7.9.5
At Fri, 10 Aug 2012 10:18:57 +0000, Lin, Mengdong wrote:
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 mengdong.lin@intel.com
Hm, it's still sent in quoted-printable format, so can't be fed to git am...
Takashi
At Fri, 10 Aug 2012 12:35:52 +0200, Takashi Iwai wrote:
At Fri, 10 Aug 2012 10:18:57 +0000, Lin, Mengdong wrote:
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 mengdong.lin@intel.com
Hm, it's still sent in quoted-printable format, so can't be fed to git am...
I applied the patch now manually. At the next time, please send the patch in a right format.
thanks,
Takashi
Hi Takashi,
Sorry for using HTML format. The patch is resent with new subject: [PATCH] ALSA : hda - bug fix on checking the supported power states of a codec. Please review, thanks again!
Mengdong
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Friday, August 10, 2012 6:11 PM To: Lin, Mengdong Cc: alsa-devel@alsa-project.org; Wang, Xingchao Subject: Re: [PATCH] ALSA : hda - bug fix on return value check when getting supported power states of a codec
At Fri, 10 Aug 2012 09:15:51 +0000, Lin, Mengdong wrote:
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 mengdong.lin@intel.com
Could you resend in a normal text? It's garbled badly with HTML in the signature and can't be applied.
Also, try to shorten the subject a bit more.
thanks,
Takashi
participants (2)
-
Lin, Mengdong
-
Takashi Iwai