forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/codecs/wm0010.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * wm0010.c -- WM0010 DSP Driver
34 *
....@@ -6,10 +7,6 @@
67 * Authors: Mark Brown <broonie@opensource.wolfsonmicro.com>
78 * Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
89 * Scott Ling <sl@opensource.wolfsonmicro.com>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1310 */
1411
1512 #include <linux/module.h>
....@@ -46,7 +43,7 @@
4643 u8 command;
4744 u32 length:24;
4845 u32 address;
49
- uint8_t data[0];
46
+ uint8_t data[];
5047 } __packed;
5148
5249 struct dfw_inforec {
....@@ -349,7 +346,7 @@
349346 struct list_head xfer_list;
350347 struct wm0010_boot_xfer *xfer;
351348 int ret;
352
- struct completion done;
349
+ DECLARE_COMPLETION_ONSTACK(done);
353350 const struct firmware *fw;
354351 const struct dfw_binrec *rec;
355352 const struct dfw_inforec *inforec;
....@@ -373,7 +370,6 @@
373370 wm0010->boot_failed = false;
374371 if (WARN_ON(!list_empty(&xfer_list)))
375372 return -EINVAL;
376
- init_completion(&done);
377373
378374 /* First record should be INFO */
379375 if (rec->command != DFW_CMD_INFO) {
....@@ -518,7 +514,7 @@
518514 dev_dbg(component->dev, "Downloading %zu byte stage 2 loader\n", fw->size);
519515
520516 /* Copy to local buffer first as vmalloc causes problems for dma */
521
- img = kzalloc(fw->size, GFP_KERNEL | GFP_DMA);
517
+ img = kmemdup(&fw->data[0], fw->size, GFP_KERNEL | GFP_DMA);
522518 if (!img) {
523519 ret = -ENOMEM;
524520 goto abort2;
....@@ -529,8 +525,6 @@
529525 ret = -ENOMEM;
530526 goto abort1;
531527 }
532
-
533
- memcpy(img, &fw->data[0], fw->size);
534528
535529 spi_message_init(&m);
536530 memset(&t, 0, sizeof(t));