|
@@ -294,8 +294,21 @@ int snd_timer_open(struct snd_timer_instance **ti,
|
|
|
get_device(&timer->card->card_dev);
|
|
|
timeri->slave_class = tid->dev_sclass;
|
|
|
timeri->slave_id = slave_id;
|
|
|
- if (list_empty(&timer->open_list_head) && timer->hw.open)
|
|
|
- timer->hw.open(timer);
|
|
|
+
|
|
|
+ if (list_empty(&timer->open_list_head) && timer->hw.open) {
|
|
|
+ int err = timer->hw.open(timer);
|
|
|
+ if (err) {
|
|
|
+ kfree(timeri->owner);
|
|
|
+ kfree(timeri);
|
|
|
+
|
|
|
+ if (timer->card)
|
|
|
+ put_device(&timer->card->card_dev);
|
|
|
+ module_put(timer->module);
|
|
|
+ mutex_unlock(®ister_mutex);
|
|
|
+ return err;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
list_add_tail(&timeri->open_list, &timer->open_list_head);
|
|
|
snd_timer_check_master(timeri);
|
|
|
mutex_unlock(®ister_mutex);
|