Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 22801
b: refs/heads/master
c: c6077b3
h: refs/heads/master
i:
  22799: f35014f
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Mar 22, 2006
1 parent 4c1c736 commit ac9160c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5c079e31cba3e6f93ef098911e216b79d0a84e8
refs/heads/master: c6077b3000184c7f69c4798b9025e5fbd69c8c62
19 changes: 12 additions & 7 deletions trunk/sound/core/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,28 +309,29 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
{
struct snd_ctl_elem_id id;
unsigned int idx;
int err = -EINVAL;

snd_assert(card != NULL, return -EINVAL);
if (! kcontrol)
return -EINVAL;
snd_assert(kcontrol->info != NULL, return -EINVAL);
return err;
snd_assert(card != NULL, goto error);
snd_assert(kcontrol->info != NULL, goto error);
id = kcontrol->id;
down_write(&card->controls_rwsem);
if (snd_ctl_find_id(card, &id)) {
up_write(&card->controls_rwsem);
snd_ctl_free_one(kcontrol);
snd_printd(KERN_ERR "control %i:%i:%i:%s:%i is already present\n",
id.iface,
id.device,
id.subdevice,
id.name,
id.index);
return -EBUSY;
err = -EBUSY;
goto error;
}
if (snd_ctl_find_hole(card, kcontrol->count) < 0) {
up_write(&card->controls_rwsem);
snd_ctl_free_one(kcontrol);
return -ENOMEM;
err = -ENOMEM;
goto error;
}
list_add_tail(&kcontrol->list, &card->controls);
card->controls_count += kcontrol->count;
Expand All @@ -340,6 +341,10 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++)
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);
return 0;

error:
snd_ctl_free_one(kcontrol);
return err;
}

/**
Expand Down

0 comments on commit ac9160c

Please sign in to comment.