aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/card.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/card.c')
-rw-r--r--sound/usb/card.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c
index c3b5b7dca1c3..a09e5f3519e3 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -307,6 +307,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
307 307
308static int snd_usb_audio_free(struct snd_usb_audio *chip) 308static int snd_usb_audio_free(struct snd_usb_audio *chip)
309{ 309{
310 struct list_head *p, *n;
311
312 list_for_each_safe(p, n, &chip->ep_list)
313 snd_usb_endpoint_free(p);
314
310 mutex_destroy(&chip->mutex); 315 mutex_destroy(&chip->mutex);
311 kfree(chip); 316 kfree(chip);
312 return 0; 317 return 0;
@@ -585,7 +590,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
585 struct snd_usb_audio *chip) 590 struct snd_usb_audio *chip)
586{ 591{
587 struct snd_card *card; 592 struct snd_card *card;
588 struct list_head *p, *n; 593 struct list_head *p;
589 594
590 if (chip == (void *)-1L) 595 if (chip == (void *)-1L)
591 return; 596 return;
@@ -598,14 +603,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
598 mutex_lock(&register_mutex); 603 mutex_lock(&register_mutex);
599 chip->num_interfaces--; 604 chip->num_interfaces--;
600 if (chip->num_interfaces <= 0) { 605 if (chip->num_interfaces <= 0) {
606 struct snd_usb_endpoint *ep;
607
601 snd_card_disconnect(card); 608 snd_card_disconnect(card);
602 /* release the pcm resources */ 609 /* release the pcm resources */
603 list_for_each(p, &chip->pcm_list) { 610 list_for_each(p, &chip->pcm_list) {
604 snd_usb_stream_disconnect(p); 611 snd_usb_stream_disconnect(p);
605 } 612 }
606 /* release the endpoint resources */ 613 /* release the endpoint resources */
607 list_for_each_safe(p, n, &chip->ep_list) { 614 list_for_each_entry(ep, &chip->ep_list, list) {
608 snd_usb_endpoint_free(p); 615 snd_usb_endpoint_release(ep);
609 } 616 }
610 /* release the midi resources */ 617 /* release the midi resources */
611 list_for_each(p, &chip->midi_list) { 618 list_for_each(p, &chip->midi_list) {