summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_local.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-01-10 12:41:22 +0100
committerTakashi Iwai <tiwai@suse.de>2012-01-10 12:41:22 +0100
commit3a90274de3548ebb2aabfbf488cea8e275a73dc6 (patch)
tree062bf3d12a3db01de80533b58f25a0eac6149060 /sound/pci/hda/hda_local.h
parentde4da59e480cdf1075b33dbaf8078fc87bc52241 (diff)
downloadblackbird-op-linux-3a90274de3548ebb2aabfbf488cea8e275a73dc6.tar.gz
blackbird-op-linux-3a90274de3548ebb2aabfbf488cea8e275a73dc6.zip
ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs
When an invalid NID is given, get_wcaps() returns zero as the error, but get_wcaps_type() takes it as the normal value and returns a bogus AC_WID_AUD_OUT value. This confuses the parser. With this patch, get_wcaps_type() returns -1 when value 0 is given, i.e. an invalid NID is passed to get_wcaps(). Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740118 Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r--sound/pci/hda/hda_local.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index e1abc07f7436..aca8d3193b95 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -488,7 +488,12 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
}
/* get the widget type from widget capability bits */
-#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT)
+static inline int get_wcaps_type(unsigned int wcaps)
+{
+ if (!wcaps)
+ return -1; /* invalid type */
+ return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
+}
static inline unsigned int get_wcaps_channels(u32 wcaps)
{
OpenPOWER on IntegriCloud