[alsa-devel] [PATCH] ALSA: fireworks/bebob: fix refering to released resources at unplugging

Takashi Sakamoto o-takashi at sakamocchi.jp
Wed Jan 21 00:07:30 CET 2015


Unplugging devices can cause disorder by releasing streaming resources
before stopping playbacking/capturing substreams. This commit forces
the state of ALSA character devices into disconnect before releasing
the resources.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 sound/firewire/bebob/bebob.c         | 3 ++-
 sound/firewire/fireworks/fireworks.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
index fc19c99..41eb1ce 100644
--- a/sound/firewire/bebob/bebob.c
+++ b/sound/firewire/bebob/bebob.c
@@ -306,10 +306,11 @@ static void bebob_remove(struct fw_unit *unit)
 	if (bebob == NULL)
 		return;
 
+	snd_card_disconnect(bebob->card);
+
 	kfree(bebob->maudio_special_quirk);
 
 	snd_bebob_stream_destroy_duplex(bebob);
-	snd_card_disconnect(bebob->card);
 	snd_card_free_when_closed(bebob->card);
 }
 
diff --git a/sound/firewire/fireworks/fireworks.c b/sound/firewire/fireworks/fireworks.c
index 3e2ed8e..21fb50f 100644
--- a/sound/firewire/fireworks/fireworks.c
+++ b/sound/firewire/fireworks/fireworks.c
@@ -289,10 +289,11 @@ static void efw_remove(struct fw_unit *unit)
 {
 	struct snd_efw *efw = dev_get_drvdata(&unit->device);
 
+	snd_card_disconnect(efw->card);
+
 	snd_efw_stream_destroy_duplex(efw);
 	snd_efw_transaction_remove_instance(efw);
 
-	snd_card_disconnect(efw->card);
 	snd_card_free_when_closed(efw->card);
 }
 
-- 
2.1.0



More information about the Alsa-devel mailing list