summary refs log tree commit diff
path: root/sound/isa/sb
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-12-20 20:15:19 +0100
committerTakashi Iwai <tiwai@suse.de>2009-12-21 12:03:11 +0100
commitdb8cf334f66bdf1ba2b3d2f7128095fc9b7a6e2b (patch)
treeb6b90f29fb295be3df8f6083057cee738a5c2081 /sound/isa/sb
parent40962d7c741de1c21b6ce8516c1d9f8836fb383e (diff)
downloadlinux-db8cf334f66bdf1ba2b3d2f7128095fc9b7a6e2b.tar.gz
ALSA: sbawe: fix memory detection
Memory amount is increased before a successful write-read
sequence is done. Thus, 512 kB of onboard memory is detected
on memoryless cards like SB32.

Move the increasing of memory counter after successful read
is done.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/sb')
-rw-r--r--sound/isa/sb/emu8000.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 96678d5d3834..751762f1c59a 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -393,8 +393,6 @@ size_dram(struct snd_emu8000 *emu)
 
 	while (size < EMU8000_MAX_DRAM) {
 
-		size += 512 * 1024;  /* increment 512kbytes */
-
 		/* Write a unique data on the test address.
 		 * if the address is out of range, the data is written on
 		 * 0x200000(=EMU8000_DRAM_OFFSET).  Then the id word is
@@ -414,7 +412,9 @@ size_dram(struct snd_emu8000 *emu)
 		/*snd_emu8000_read_wait(emu);*/
 		EMU8000_SMLD_READ(emu); /* discard stale data  */
 		if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
-			break; /* we must have wrapped around */
+			break; /* no memory at this address */
+
+		size += 512 * 1024;  /* increment 512kbytes */
 
 		snd_emu8000_read_wait(emu);