diff options
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index edb67138d548..76ca176eac07 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -261,6 +261,7 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
261 | const struct wm_adsp_region *mem; | 261 | const struct wm_adsp_region *mem; |
262 | const char *region_name; | 262 | const char *region_name; |
263 | char *file, *text; | 263 | char *file, *text; |
264 | void *buf; | ||
264 | unsigned int reg; | 265 | unsigned int reg; |
265 | int regions = 0; | 266 | int regions = 0; |
266 | int ret, offset, type, sizes; | 267 | int ret, offset, type, sizes; |
@@ -415,8 +416,18 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
415 | } | 416 | } |
416 | 417 | ||
417 | if (reg) { | 418 | if (reg) { |
418 | ret = regmap_raw_write(regmap, reg, region->data, | 419 | buf = kmemdup(region->data, le32_to_cpu(region->len), |
420 | GFP_KERNEL | GFP_DMA); | ||
421 | if (!buf) { | ||
422 | adsp_err(dsp, "Out of memory\n"); | ||
423 | return -ENOMEM; | ||
424 | } | ||
425 | |||
426 | ret = regmap_raw_write(regmap, reg, buf, | ||
419 | le32_to_cpu(region->len)); | 427 | le32_to_cpu(region->len)); |
428 | |||
429 | kfree(buf); | ||
430 | |||
420 | if (ret != 0) { | 431 | if (ret != 0) { |
421 | adsp_err(dsp, | 432 | adsp_err(dsp, |
422 | "%s.%d: Failed to write %d bytes at %d in %s: %d\n", | 433 | "%s.%d: Failed to write %d bytes at %d in %s: %d\n", |
@@ -664,6 +675,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
664 | const char *region_name; | 675 | const char *region_name; |
665 | int ret, pos, blocks, type, offset, reg; | 676 | int ret, pos, blocks, type, offset, reg; |
666 | char *file; | 677 | char *file; |
678 | void *buf; | ||
667 | 679 | ||
668 | file = kzalloc(PAGE_SIZE, GFP_KERNEL); | 680 | file = kzalloc(PAGE_SIZE, GFP_KERNEL); |
669 | if (file == NULL) | 681 | if (file == NULL) |
@@ -774,6 +786,13 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
774 | } | 786 | } |
775 | 787 | ||
776 | if (reg) { | 788 | if (reg) { |
789 | buf = kmemdup(blk->data, le32_to_cpu(blk->len), | ||
790 | GFP_KERNEL | GFP_DMA); | ||
791 | if (!buf) { | ||
792 | adsp_err(dsp, "Out of memory\n"); | ||
793 | return -ENOMEM; | ||
794 | } | ||
795 | |||
777 | ret = regmap_raw_write(regmap, reg, blk->data, | 796 | ret = regmap_raw_write(regmap, reg, blk->data, |
778 | le32_to_cpu(blk->len)); | 797 | le32_to_cpu(blk->len)); |
779 | if (ret != 0) { | 798 | if (ret != 0) { |
@@ -781,6 +800,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
781 | "%s.%d: Failed to write to %x in %s\n", | 800 | "%s.%d: Failed to write to %x in %s\n", |
782 | file, blocks, reg, region_name); | 801 | file, blocks, reg, region_name); |
783 | } | 802 | } |
803 | |||
804 | kfree(buf); | ||
784 | } | 805 | } |
785 | 806 | ||
786 | pos += le32_to_cpu(blk->len) + sizeof(*blk); | 807 | pos += le32_to_cpu(blk->len) + sizeof(*blk); |