From 01e5f5b30e5b6192d96975c42b201a35ba08cccf Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Jan 2012 12:41:22 +0100 Subject: [PATCH] --- yaml --- r: 284228 b: refs/heads/master c: 3a90274de3548ebb2aabfbf488cea8e275a73dc6 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/sound/pci/hda/hda_local.h | 7 ++++++- trunk/sound/pci/hda/hda_proc.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index c9c3a78daa33..812f6ba58893 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: de4da59e480cdf1075b33dbaf8078fc87bc52241 +refs/heads/master: 3a90274de3548ebb2aabfbf488cea8e275a73dc6 diff --git a/trunk/sound/pci/hda/hda_local.h b/trunk/sound/pci/hda/hda_local.h index e1abc07f7436..aca8d3193b95 100644 --- a/trunk/sound/pci/hda/hda_local.h +++ b/trunk/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) { diff --git a/trunk/sound/pci/hda/hda_proc.c b/trunk/sound/pci/hda/hda_proc.c index 2c981b55940b..254ab5204603 100644 --- a/trunk/sound/pci/hda/hda_proc.c +++ b/trunk/sound/pci/hda/hda_proc.c @@ -54,6 +54,8 @@ static const char *get_wid_type_name(unsigned int wid_value) [AC_WID_BEEP] = "Beep Generator Widget", [AC_WID_VENDOR] = "Vendor Defined Widget", }; + if (wid_value == -1) + return "UNKNOWN Widget"; wid_value &= 0xf; if (names[wid_value]) return names[wid_value];