diff options
Diffstat (limited to 'sound/core/rawmidi.c')
-rw-r--r-- | sound/core/rawmidi.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 795437b10082..b450a27588c8 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -1633,11 +1633,13 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1633 | return -EBUSY; | 1633 | return -EBUSY; |
1634 | } | 1634 | } |
1635 | list_add_tail(&rmidi->list, &snd_rawmidi_devices); | 1635 | list_add_tail(&rmidi->list, &snd_rawmidi_devices); |
1636 | mutex_unlock(®ister_mutex); | ||
1636 | err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, | 1637 | err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI, |
1637 | rmidi->card, rmidi->device, | 1638 | rmidi->card, rmidi->device, |
1638 | &snd_rawmidi_f_ops, rmidi, &rmidi->dev); | 1639 | &snd_rawmidi_f_ops, rmidi, &rmidi->dev); |
1639 | if (err < 0) { | 1640 | if (err < 0) { |
1640 | rmidi_err(rmidi, "unable to register\n"); | 1641 | rmidi_err(rmidi, "unable to register\n"); |
1642 | mutex_lock(®ister_mutex); | ||
1641 | list_del(&rmidi->list); | 1643 | list_del(&rmidi->list); |
1642 | mutex_unlock(®ister_mutex); | 1644 | mutex_unlock(®ister_mutex); |
1643 | return err; | 1645 | return err; |
@@ -1645,6 +1647,7 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1645 | if (rmidi->ops && rmidi->ops->dev_register && | 1647 | if (rmidi->ops && rmidi->ops->dev_register && |
1646 | (err = rmidi->ops->dev_register(rmidi)) < 0) { | 1648 | (err = rmidi->ops->dev_register(rmidi)) < 0) { |
1647 | snd_unregister_device(&rmidi->dev); | 1649 | snd_unregister_device(&rmidi->dev); |
1650 | mutex_lock(®ister_mutex); | ||
1648 | list_del(&rmidi->list); | 1651 | list_del(&rmidi->list); |
1649 | mutex_unlock(®ister_mutex); | 1652 | mutex_unlock(®ister_mutex); |
1650 | return err; | 1653 | return err; |
@@ -1677,7 +1680,6 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1677 | } | 1680 | } |
1678 | } | 1681 | } |
1679 | #endif /* CONFIG_SND_OSSEMUL */ | 1682 | #endif /* CONFIG_SND_OSSEMUL */ |
1680 | mutex_unlock(®ister_mutex); | ||
1681 | sprintf(name, "midi%d", rmidi->device); | 1683 | sprintf(name, "midi%d", rmidi->device); |
1682 | entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root); | 1684 | entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root); |
1683 | if (entry) { | 1685 | if (entry) { |