Skip to contentSkip to conversation

Fix lockdep warning in ASoC machine probe

PATCH Applied Mark Brown 2 participants 2 messages Jan 21, 2008

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 Fix lockdep warning in ASoC machine probe

Don't take the codec mutex during machine probe until we have registered with ALSA, fixing a lockdep warning reported by Dmitry Baryshkov.

Cc Dmitry Baryshkov <[email protected]>
---
 sound/soc/soc-core.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +5 -2
index 2eb9b20..78d1662 100644
@@ -1098,7 +1098,6 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
 	struct snd_soc_machine *machine = socdev->machine;
 	int ret = 0, i, ac97 = 0, err = 0;
 
-	mutex_lock(&codec->mutex);
 	for(i = 0; i < machine->num_links; i++) {
 		if (socdev->machine->dai_link[i].init) {
 			err = socdev->machine->dai_link[i].init(codec);
@@ -1124,12 +1123,14 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
 		goto out;
 	}
 
+	mutex_lock(&codec->mutex);
 #ifdef CONFIG_SND_SOC_AC97_BUS
 	if (ac97) {
 		ret = soc_ac97_dev_register(codec);
 		if (ret < 0) {
 			printk(KERN_ERR "asoc: AC97 device register failed\n");
 			snd_card_free(codec->card);
+			mutex_unlock(&codec->mutex);
 			goto out;
 		}
 	}
@@ -1142,8 +1143,10 @@ int snd_soc_register_card(struct snd_soc_device *socdev)
 	err = device_create_file(socdev->dev, &dev_attr_codec_reg);
 	if (err < 0)
 		printk(KERN_WARNING "asoc: failed to add codec sysfs entries\n");
-out:
+
 	mutex_unlock(&codec->mutex);
+
+out:
 	return ret;
 }
 EXPORT_SYMBOL_GPL(snd_soc_register_card);
Signature · 1 line
1.5.3.8
Applied
#1 lore raw

At Mon, 21 Jan 2008 13:04:42 +0000,

Quoted 6 lines · Mark Brown

Don't take the codec mutex during machine probe until we have registered with ALSA, fixing a lockdep warning reported by Dmitry Baryshkov.

Cc Dmitry Baryshkov <[email protected]>

Applied to HG tree. Thanks.

Takashi