|
@@ -1633,11 +1633,13 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
|
|
|
return -EBUSY;
|
|
|
}
|
|
|
list_add_tail(&rmidi->list, &snd_rawmidi_devices);
|
|
|
+ mutex_unlock(®ister_mutex);
|
|
|
err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI,
|
|
|
rmidi->card, rmidi->device,
|
|
|
&snd_rawmidi_f_ops, rmidi, &rmidi->dev);
|
|
|
if (err < 0) {
|
|
|
rmidi_err(rmidi, "unable to register\n");
|
|
|
+ mutex_lock(®ister_mutex);
|
|
|
list_del(&rmidi->list);
|
|
|
mutex_unlock(®ister_mutex);
|
|
|
return err;
|
|
@@ -1645,6 +1647,7 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
|
|
|
if (rmidi->ops && rmidi->ops->dev_register &&
|
|
|
(err = rmidi->ops->dev_register(rmidi)) < 0) {
|
|
|
snd_unregister_device(&rmidi->dev);
|
|
|
+ mutex_lock(®ister_mutex);
|
|
|
list_del(&rmidi->list);
|
|
|
mutex_unlock(®ister_mutex);
|
|
|
return err;
|
|
@@ -1677,7 +1680,6 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
|
|
|
}
|
|
|
}
|
|
|
#endif /* CONFIG_SND_OSSEMUL */
|
|
|
- mutex_unlock(®ister_mutex);
|
|
|
sprintf(name, "midi%d", rmidi->device);
|
|
|
entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root);
|
|
|
if (entry) {
|