From patchwork Tue Jan 20 23:07:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 5672691 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F55BC058D for ; Tue, 20 Jan 2015 23:08:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0313204EA for ; Tue, 20 Jan 2015 23:07:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id ADCD1204E2 for ; Tue, 20 Jan 2015 23:07:55 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9583426087F; Wed, 21 Jan 2015 00:07:53 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 7199A260710; Wed, 21 Jan 2015 00:07:46 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id A06512607FF; Wed, 21 Jan 2015 00:07:44 +0100 (CET) Received: from smtp301.phy.lolipop.jp (smtp301.phy.lolipop.jp [210.157.22.84]) by alsa0.perex.cz (Postfix) with ESMTP id B7B21260705 for ; Wed, 21 Jan 2015 00:07:37 +0100 (CET) Received: from smtp301.phy.lolipop.lan (HELO smtp301.phy.lolipop.jp) (172.17.1.84) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp301.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Wed, 21 Jan 2015 08:07:34 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp301.phy.lolipop.jp (LOLIPOP-Fsecure); Wed, 21 Jan 2015 08:07:30 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Wed, 21 Jan 2015 08:07:30 +0900 Message-Id: <1421795250-7528-1-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.1.0 Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH] ALSA: fireworks/bebob: fix refering to released resources at unplugging X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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); }