From 4bd4127dbbc4a30a05edacaaaeebe88d18f73aec Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Fri, 17 Jul 2009 16:49:19 +0800 Subject: [PATCH] --- yaml --- r: 157794 b: refs/heads/master c: 6430aeeb30b478d4ef25f988b1fde6f6ae83adb5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/sound/pci/hda/hda_codec.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index ed5006c93b95..9eb4db0487ee 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9176b672c29baaa94cdff4eedf1350a3b553d9ea +refs/heads/master: 6430aeeb30b478d4ef25f988b1fde6f6ae83adb5 diff --git a/trunk/sound/pci/hda/hda_codec.c b/trunk/sound/pci/hda/hda_codec.c index ec352c6ae49a..d9d326297834 100644 --- a/trunk/sound/pci/hda/hda_codec.c +++ b/trunk/sound/pci/hda/hda_codec.c @@ -150,7 +150,14 @@ make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, { u32 val; - val = (u32)(codec->addr & 0x0f) << 28; + if ((codec->addr & ~0xf) | (direct & ~1) | (nid & ~0x7f) | + (verb & ~0xfff) | (parm & ~0xff)) { + printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x:%x\n", + codec->addr, direct, nid, verb, parm); + return ~0; + } + + val = (u32)codec->addr << 28; val |= (u32)direct << 27; val |= (u32)nid << 20; val |= verb << 8; @@ -167,6 +174,9 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, struct hda_bus *bus = codec->bus; int err; + if (cmd == ~0) + return -1; + if (res) *res = -1; again: