]> err.no Git - linux-2.6/commitdiff
[ALSA] emu10k1 - Minor clean up of memory block handling
authorTakashi Iwai <tiwai@suse.de>
Thu, 17 Nov 2005 09:44:51 +0000 (10:44 +0100)
committerJaroslav Kysela <perex@suse.cz>
Tue, 3 Jan 2006 11:17:06 +0000 (12:17 +0100)
Modules: EMU10K1/EMU10K2 driver

Minor clean up of emu10k1 memory block allocation.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emupcm.c

index 90d3a0b50d1713778dd7bec2b692873845a13a46..166f7c4d28c964d772f3b8851dc753becd42b0a1 100644 (file)
@@ -405,15 +405,17 @@ static int snd_emu10k1_playback_hw_params(snd_pcm_substream_t * substream,
        if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
                return err;
        if (err > 0) {  /* change */
-               snd_util_memblk_t *memblk;
+               int mapped;
                if (epcm->memblk != NULL)
                        snd_emu10k1_free_pages(emu, epcm->memblk);
-               memblk = snd_emu10k1_alloc_pages(emu, substream);
-               if ((epcm->memblk = memblk) == NULL || ((emu10k1_memblk_t *)memblk)->mapped_page < 0) {
-                       epcm->start_addr = 0;
+               epcm->memblk = snd_emu10k1_alloc_pages(emu, substream);
+               epcm->start_addr = 0;
+               if (! epcm->memblk)
                        return -ENOMEM;
-               }
-               epcm->start_addr = ((emu10k1_memblk_t *)memblk)->mapped_page << PAGE_SHIFT;
+               mapped = ((emu10k1_memblk_t *)epcm->memblk)->mapped_page;
+               if (mapped < 0)
+                       return -ENOMEM;
+               epcm->start_addr = mapped << PAGE_SHIFT;
        }
        return 0;
 }