.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * wm0010.c -- WM0010 DSP Driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * Authors: Mark Brown <broonie@opensource.wolfsonmicro.com> |
---|
7 | 8 | * Dimitris Papastamos <dp@opensource.wolfsonmicro.com> |
---|
8 | 9 | * 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. |
---|
13 | 10 | */ |
---|
14 | 11 | |
---|
15 | 12 | #include <linux/module.h> |
---|
.. | .. |
---|
46 | 43 | u8 command; |
---|
47 | 44 | u32 length:24; |
---|
48 | 45 | u32 address; |
---|
49 | | - uint8_t data[0]; |
---|
| 46 | + uint8_t data[]; |
---|
50 | 47 | } __packed; |
---|
51 | 48 | |
---|
52 | 49 | struct dfw_inforec { |
---|
.. | .. |
---|
349 | 346 | struct list_head xfer_list; |
---|
350 | 347 | struct wm0010_boot_xfer *xfer; |
---|
351 | 348 | int ret; |
---|
352 | | - struct completion done; |
---|
| 349 | + DECLARE_COMPLETION_ONSTACK(done); |
---|
353 | 350 | const struct firmware *fw; |
---|
354 | 351 | const struct dfw_binrec *rec; |
---|
355 | 352 | const struct dfw_inforec *inforec; |
---|
.. | .. |
---|
373 | 370 | wm0010->boot_failed = false; |
---|
374 | 371 | if (WARN_ON(!list_empty(&xfer_list))) |
---|
375 | 372 | return -EINVAL; |
---|
376 | | - init_completion(&done); |
---|
377 | 373 | |
---|
378 | 374 | /* First record should be INFO */ |
---|
379 | 375 | if (rec->command != DFW_CMD_INFO) { |
---|
.. | .. |
---|
518 | 514 | dev_dbg(component->dev, "Downloading %zu byte stage 2 loader\n", fw->size); |
---|
519 | 515 | |
---|
520 | 516 | /* 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); |
---|
522 | 518 | if (!img) { |
---|
523 | 519 | ret = -ENOMEM; |
---|
524 | 520 | goto abort2; |
---|
.. | .. |
---|
529 | 525 | ret = -ENOMEM; |
---|
530 | 526 | goto abort1; |
---|
531 | 527 | } |
---|
532 | | - |
---|
533 | | - memcpy(img, &fw->data[0], fw->size); |
---|
534 | 528 | |
---|
535 | 529 | spi_message_init(&m); |
---|
536 | 530 | memset(&t, 0, sizeof(t)); |
---|