Skip to contentSkip to conversation

ALSA: snd-usb: use list_for_each_safe for endpoint resources

PATCH Applied Pavel Roskin 2 participants 2 messages Aug 30, 2012 – Aug 31, 2012 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: snd-usb: use list_for_each_safe for endpoint resources

snd_usb_endpoint_free() frees the structure that contains its argument.

---

 sound/usb/card.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/card.c +2 -2
index d5b5c33..4a469f0 100644
@@ -553,7 +553,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 				     struct snd_usb_audio *chip)
 {
 	struct snd_card *card;
-	struct list_head *p;
+	struct list_head *p, *n;
 
 	if (chip == (void *)-1L)
 		return;
@@ -570,7 +570,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 			snd_usb_stream_disconnect(p);
 		}
 		/* release the endpoint resources */
-		list_for_each(p, &chip->ep_list) {
+		list_for_each_safe(p, n, &chip->ep_list) {
 			snd_usb_endpoint_free(p);
 		}
 		/* release the midi resources */
Applied
#1 lore raw

At Thu, 30 Aug 2012 17:11:17 -0400,

Quoted 5 lines · Pavel Roskin

snd_usb_endpoint_free() frees the structure that contains its argument.

Thanks, applied now.

Takashi

Quoted 28 lines

---

 sound/usb/card.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/card.c +2 -2
index d5b5c33..4a469f0 100644
@@ -553,7 +553,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 				     struct snd_usb_audio *chip)
 {
 	struct snd_card *card;
-	struct list_head *p;
+	struct list_head *p, *n;
 
 	if (chip == (void *)-1L)
 		return;
@@ -570,7 +570,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
 			snd_usb_stream_disconnect(p);
 		}
 		/* release the endpoint resources */
-		list_for_each(p, &chip->ep_list) {
+		list_for_each_safe(p, n, &chip->ep_list) {
 			snd_usb_endpoint_free(p);
 		}
 		/* release the midi resources */