diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 45fcdff..3aa2250 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -378,13 +378,13 @@ init_arrays(struct snd_emu8000 *emu)
 static void
 size_dram(struct snd_emu8000 *emu)
 {
-	int i, size, detected_size;
+	int i, size;
+	unsigned short rdback;
 
 	if (emu->dram_checked)
 		return;
 
 	size = 0;
-	detected_size = 0;
 
 	/* write out a magic number */
 	snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE);
@@ -392,55 +392,81 @@ size_dram(struct snd_emu8000 *emu)
 	EMU8000_SMALW_WRITE(emu, EMU8000_DRAM_OFFSET);
 	EMU8000_SMLD_WRITE(emu, UNIQUE_ID1);
 	snd_emu8000_init_fm(emu); /* This must really be here and not 2 lines back even */
-
-	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
-		 * changed by this data.
-		 */
-		/*snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_WRITE);*/
-		EMU8000_SMALW_WRITE(emu, EMU8000_DRAM_OFFSET + (size>>1));
-		EMU8000_SMLD_WRITE(emu, UNIQUE_ID2);
-		snd_emu8000_write_wait(emu);
-
-		/*
-		 * read the data on the just written DRAM address
-		 * if not the same then we have reached the end of ram.
-		 */
-		/*snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_READ);*/
-		EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET + (size>>1));
-		/*snd_emu8000_read_wait(emu);*/
-		EMU8000_SMLD_READ(emu); /* discard stale data  */
-		if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2)
-			break; /* no memory at this address */
+	snd_emu8000_write_wait(emu);
+
+	/* If that didn't work, we have no RAM at all. */
+	EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET);
+	rdback = EMU8000_SMLD_READ(emu);
+	snd_printdd("EMU8000 [0x%lx]: initial discard data = %04hx\n",
+		emu->port1, rdback);
+	rdback = EMU8000_SMLD_READ(emu);
+	snd_printdd("EMU8000 [0x%lx]: initial readback = %04hx\n",
+		emu->port1, rdback);
+	if (rdback == UNIQUE_ID1) {
 		snd_emu8000_read_wait(emu);
 
 		/*
-		 * If it is the same it could be that the address just
-		 * wraps back to the beginning; so check to see if the
-		 * initial value has been overwritten.
+		 * If a write succeeds at the beginning of a 512 KiB page we
+		 * assume that the whole page is there.
 		 */
-		EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET);
-		EMU8000_SMLD_READ(emu); /* discard stale data  */
-		if (EMU8000_SMLD_READ(emu) != UNIQUE_ID1)
-			break; /* we must have wrapped around */
-		snd_emu8000_read_wait(emu);
-
-		/* Otherwise, it's valid memory. */
-		detected_size = size + 512 * 1024;
-	}
-
-	/* Distinguish 512 KiB from 0. */
-	if (detected_size == 0) {
-		snd_emu8000_read_wait(emu);
-		EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET);
-		EMU8000_SMLD_READ(emu); /* discard stale data  */
-		if (EMU8000_SMLD_READ(emu) == UNIQUE_ID1)
-			detected_size = 512 * 1024;
+		size = 512 * 1024;
+
+		while (size < EMU8000_MAX_DRAM) {
+			/*
+			 * 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 changed by this data.
+			 */
+			EMU8000_SMALW_WRITE(emu, EMU8000_DRAM_OFFSET +
+				(size>>1));
+			EMU8000_SMLD_WRITE(emu, UNIQUE_ID2);
+			snd_emu8000_write_wait(emu);
+
+			/*
+			 * Read the data on the just written DRAM address.
+			 * If not the same then we have reached the end of RAM.
+			 */
+			EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET +
+				(size>>1));
+			rdback = EMU8000_SMLD_READ(emu);
+			snd_printdd("EMU8000 [0x%lx]: ID2 discard data = %04hx\n",
+				emu->port1, rdback);
+			rdback = EMU8000_SMLD_READ(emu);
+			snd_printdd("EMU8000 [0x%lx]: ID2 readback = %04hx\n",
+				emu->port1, rdback);
+			if (rdback != UNIQUE_ID2) {
+				snd_printdd("EMU8000 [0x%lx]: ID2 break\n",
+					emu->port1);
+				break; /* no memory at this address */
+			}
+			snd_emu8000_read_wait(emu);
+
+			/*
+			 * If it is the same it could be that the address just
+			 * wraps back to the beginning, so check to see if the
+			 * initial value has been overwritten.
+			 */
+			EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET);
+			rdback = EMU8000_SMLD_READ(emu);
+			snd_printdd("EMU8000 [0x%lx]: ID1 discard data = %04hx\n",
+				emu->port1, rdback);
+			rdback = EMU8000_SMLD_READ(emu);
+			snd_printdd("EMU8000 [0x%lx]: ID1 readback = %04hx\n",
+				emu->port1, rdback);
+			if (rdback != UNIQUE_ID1) {
+				snd_printdd("EMU8000 [0x%lx]: ID1 break\n",
+					emu->port1);
+				break; /* may have wrapped around */
+			}
+			snd_emu8000_read_wait(emu);
+
+			/* Otherwise, it's valid memory. */
+			size += 512 * 1024;
+		}
+	} else {
+		snd_printdd("EMU8000 [0x%lx]: initial test failed\n",
+			emu->port1);
 	}
 
 	/* wait until FULL bit in SMAxW register is false */
@@ -454,10 +480,9 @@ size_dram(struct snd_emu8000 *emu)
 	snd_emu8000_dma_chan(emu, 0, EMU8000_RAM_CLOSE);
 	snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE);
 
-	snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memory detected\n",
-		    emu->port1, detected_size/1024);
-
-	emu->mem_size = detected_size;
+	snd_printk(KERN_INFO "sbawe [0x%lx]: %d B on-board DRAM detected\n",
+		emu->port1, size);
+	emu->mem_size = size;
 	emu->dram_checked = 1;
 }
 
