aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/sst-firmware.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/intel/sst-firmware.c')
-rw-r--r--sound/soc/intel/sst-firmware.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index 4a5bde9c686b..a2ae2c5f2e9f 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -497,6 +497,7 @@ struct sst_module *sst_module_new(struct sst_fw *sst_fw,
497 sst_module->sst_fw = sst_fw; 497 sst_module->sst_fw = sst_fw;
498 sst_module->scratch_size = template->scratch_size; 498 sst_module->scratch_size = template->scratch_size;
499 sst_module->persistent_size = template->persistent_size; 499 sst_module->persistent_size = template->persistent_size;
500 sst_module->entry = template->entry;
500 501
501 INIT_LIST_HEAD(&sst_module->block_list); 502 INIT_LIST_HEAD(&sst_module->block_list);
502 INIT_LIST_HEAD(&sst_module->runtime_list); 503 INIT_LIST_HEAD(&sst_module->runtime_list);
@@ -706,6 +707,7 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
706 struct list_head *block_list) 707 struct list_head *block_list)
707{ 708{
708 struct sst_mem_block *block, *tmp; 709 struct sst_mem_block *block, *tmp;
710 struct sst_block_allocator ba_tmp = *ba;
709 u32 end = ba->offset + ba->size, block_end; 711 u32 end = ba->offset + ba->size, block_end;
710 int err; 712 int err;
711 713
@@ -730,9 +732,9 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
730 if (ba->offset >= block->offset && ba->offset < block_end) { 732 if (ba->offset >= block->offset && ba->offset < block_end) {
731 733
732 /* align ba to block boundary */ 734 /* align ba to block boundary */
733 ba->size -= block_end - ba->offset; 735 ba_tmp.size -= block_end - ba->offset;
734 ba->offset = block_end; 736 ba_tmp.offset = block_end;
735 err = block_alloc_contiguous(dsp, ba, block_list); 737 err = block_alloc_contiguous(dsp, &ba_tmp, block_list);
736 if (err < 0) 738 if (err < 0)
737 return -ENOMEM; 739 return -ENOMEM;
738 740
@@ -763,10 +765,14 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
763 /* does block span more than 1 section */ 765 /* does block span more than 1 section */
764 if (ba->offset >= block->offset && ba->offset < block_end) { 766 if (ba->offset >= block->offset && ba->offset < block_end) {
765 767
768 /* add block */
769 list_move(&block->list, &dsp->used_block_list);
770 list_add(&block->module_list, block_list);
766 /* align ba to block boundary */ 771 /* align ba to block boundary */
767 ba->offset = block->offset; 772 ba_tmp.size -= block_end - ba->offset;
773 ba_tmp.offset = block_end;
768 774
769 err = block_alloc_contiguous(dsp, ba, block_list); 775 err = block_alloc_contiguous(dsp, &ba_tmp, block_list);
770 if (err < 0) 776 if (err < 0)
771 return -ENOMEM; 777 return -ENOMEM;
772 778