diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 04:44:51 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:17:06 -0500 |
commit | e017fa5772cd2536b2b2fb210f5a6e86cceaa633 (patch) | |
tree | 7ab4eb659c9b88d6754ba1ca602030f3e4e0964f /sound/pci | |
parent | 89173bd41439bc6304e3e20f742e52266208ccad (diff) |
[ALSA] emu10k1 - Minor clean up of memory block handling
Modules: EMU10K1/EMU10K2 driver
Minor clean up of emu10k1 memory block allocation.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/emu10k1/emupcm.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 90d3a0b50d17..166f7c4d28c9 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -405,15 +405,17 @@ static int snd_emu10k1_playback_hw_params(snd_pcm_substream_t * substream, | |||
405 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) | 405 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) |
406 | return err; | 406 | return err; |
407 | if (err > 0) { /* change */ | 407 | if (err > 0) { /* change */ |
408 | snd_util_memblk_t *memblk; | 408 | int mapped; |
409 | if (epcm->memblk != NULL) | 409 | if (epcm->memblk != NULL) |
410 | snd_emu10k1_free_pages(emu, epcm->memblk); | 410 | snd_emu10k1_free_pages(emu, epcm->memblk); |
411 | memblk = snd_emu10k1_alloc_pages(emu, substream); | 411 | epcm->memblk = snd_emu10k1_alloc_pages(emu, substream); |
412 | if ((epcm->memblk = memblk) == NULL || ((emu10k1_memblk_t *)memblk)->mapped_page < 0) { | 412 | epcm->start_addr = 0; |
413 | epcm->start_addr = 0; | 413 | if (! epcm->memblk) |
414 | return -ENOMEM; | 414 | return -ENOMEM; |
415 | } | 415 | mapped = ((emu10k1_memblk_t *)epcm->memblk)->mapped_page; |
416 | epcm->start_addr = ((emu10k1_memblk_t *)memblk)->mapped_page << PAGE_SHIFT; | 416 | if (mapped < 0) |
417 | return -ENOMEM; | ||
418 | epcm->start_addr = mapped << PAGE_SHIFT; | ||
417 | } | 419 | } |
418 | return 0; | 420 | return 0; |
419 | } | 421 | } |