aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-09 11:24:04 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-09 11:24:04 -0500
commit6026179519896e7d35b2564e7544487d1c8948e7 (patch)
treec78c7032abce24d846423572204f1cd4e97d8efc /sound/core/init.c
parentd27146dd5b72ab7d7e641f56f4bee1484dabd0b7 (diff)
parentc2902c8ae06762d941fab64198467f78cab6f8cd (diff)
Merge branch 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa: (212 commits) [PATCH] Fix breakage with CONFIG_SYSFS_DEPRECATED [ALSA] version 1.0.14rc2 [ALSA] ASoC documentation updates [ALSA] ca0106 - Add missing sysfs device assignment [ALSA] aoa i2sbus: Stop Apple i2s DMA gracefully [ALSA] hda-codec - Add support for Fujitsu PI1556 Realtek ALC880 [ALSA] aoa: remove suspend/resume printks [ALSA] Fix possible deadlocks in sequencer at removal of ports [ALSA] emu10k1 - Fix STAC9758 front channel [ALSA] soc - Clean up with kmemdup() [ALSA] snd-ak4114: Fix two array overflows [ALSA] ac97_bus power management [ALSA] usbaudio - Add support for Edirol UA-101 [ALSA] hda-codec - Add ALC861VD/ALC660VD support [ALSA] soc - ASoC 0.13 Sharp poodle machine [ALSA] soc - ASoC 0.13 Sharp tosa machine [ALSA] soc - ASoC 0.13 spitz machine [ALSA] soc - ASoC Sharp corgi machine [ALSA] soc - ASoC 0.13 pxa2xx DMA [ALSA] soc - ASoC 0.13 pxa2xx AC97 driver ...
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index a4cc6b155ae9..db6103733742 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -114,22 +114,28 @@ struct snd_card *snd_card_new(int idx, const char *xid,
114 if (idx < 0) { 114 if (idx < 0) {
115 int idx2; 115 int idx2;
116 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) 116 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++)
117 /* idx == -1 == 0xffff means: take any free slot */
117 if (~snd_cards_lock & idx & 1<<idx2) { 118 if (~snd_cards_lock & idx & 1<<idx2) {
118 idx = idx2; 119 idx = idx2;
119 if (idx >= snd_ecards_limit) 120 if (idx >= snd_ecards_limit)
120 snd_ecards_limit = idx + 1; 121 snd_ecards_limit = idx + 1;
121 break; 122 break;
122 } 123 }
123 } else if (idx < snd_ecards_limit) { 124 } else {
124 if (snd_cards_lock & (1 << idx)) 125 if (idx < snd_ecards_limit) {
125 err = -ENODEV; /* invalid */ 126 if (snd_cards_lock & (1 << idx))
126 } else if (idx < SNDRV_CARDS) 127 err = -EBUSY; /* invalid */
127 snd_ecards_limit = idx + 1; /* increase the limit */ 128 } else {
128 else 129 if (idx < SNDRV_CARDS)
129 err = -ENODEV; 130 snd_ecards_limit = idx + 1; /* increase the limit */
131 else
132 err = -ENODEV;
133 }
134 }
130 if (idx < 0 || err < 0) { 135 if (idx < 0 || err < 0) {
131 mutex_unlock(&snd_card_mutex); 136 mutex_unlock(&snd_card_mutex);
132 snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i)\n", idx, snd_ecards_limit - 1); 137 snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i), error: %d\n",
138 idx, snd_ecards_limit - 1, err);
133 goto __error; 139 goto __error;
134 } 140 }
135 snd_cards_lock |= 1 << idx; /* lock it */ 141 snd_cards_lock |= 1 << idx; /* lock it */