From a8c558f6a3eedfb9bfd7d9d82f9d00f2f807ce7c Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sat, 27 Aug 2011 20:05:15 +0200 Subject: [PATCH] ALSA: dice: fix locking Avoid a lock inversion between dice->mutex and pcm->open_mutex. Signed-off-by: Stefan Richter Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index 2d198aed6f94..2d3a04ef9840 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c @@ -981,12 +981,12 @@ static void dice_remove(struct fw_unit *unit) { struct dice *dice = dev_get_drvdata(&unit->device); - mutex_lock(&dice->mutex); - amdtp_out_stream_pcm_abort(&dice->stream); snd_card_disconnect(dice->card); + mutex_lock(&dice->mutex); + dice_stream_stop(dice); dice_owner_clear(dice); @@ -999,8 +999,6 @@ static void dice_bus_reset(struct fw_unit *unit) { struct dice *dice = dev_get_drvdata(&unit->device); - mutex_lock(&dice->mutex); - /* * On a bus reset, the DICE firmware disables streaming and then goes * off contemplating its own navel for hundreds of milliseconds before @@ -1011,6 +1009,8 @@ static void dice_bus_reset(struct fw_unit *unit) */ amdtp_out_stream_pcm_abort(&dice->stream); + mutex_lock(&dice->mutex); + dice->global_enabled = false; dice_stream_stop_packets(dice);