Skip to content

Commit

Permalink
ALSA: hda - Fix parse of init_verbs sysfs entry
Browse files Browse the repository at this point in the history
Fixed the parse of init_verbs hwdep sysfs entry.
Simplieied using sscanf.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Feb 20, 2009
1 parent d14a7e0 commit 55290e1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sound/pci/hda/hda_hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,19 @@ static ssize_t init_verbs_store(struct device *dev,
{
struct snd_hwdep *hwdep = dev_get_drvdata(dev);
struct hda_codec *codec = hwdep->private_data;
char *p;
struct hda_verb verb, *v;
struct hda_verb *v;
int nid, verb, param;

verb.nid = simple_strtoul(buf, &p, 0);
verb.verb = simple_strtoul(p, &p, 0);
verb.param = simple_strtoul(p, &p, 0);
if (!verb.nid || !verb.verb || !verb.param)
if (sscanf(buf, "%i %i %i", &nid, &verb, &param) != 3)
return -EINVAL;
if (!nid || !verb)
return -EINVAL;
v = snd_array_new(&codec->init_verbs);
if (!v)
return -ENOMEM;
*v = verb;
v->nid = nid;
v->verb = verb;
v->param = param;
return count;
}

Expand Down

0 comments on commit 55290e1

Please sign in to comment.