mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
ALSA: hda - Fix parse of init_verbs sysfs entry
Fixed the parse of init_verbs hwdep sysfs entry. Simplieied using sscanf. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d14a7e0bfc
commit
55290e1932
@ -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, ¶m) != 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user