| .. | .. |
|---|
| 10 | 10 | #include <linux/of.h> |
|---|
| 11 | 11 | #include <linux/of_platform.h> |
|---|
| 12 | 12 | #include <linux/jiffies.h> |
|---|
| 13 | | -#include <linux/wait.h> |
|---|
| 14 | 13 | #include <linux/soc/qcom/apr.h> |
|---|
| 15 | 14 | #include "q6core.h" |
|---|
| 16 | 15 | #include "q6dsp-errno.h" |
|---|
| .. | .. |
|---|
| 99 | 98 | } |
|---|
| 100 | 99 | case AVCS_CMDRSP_GET_FWK_VERSION: { |
|---|
| 101 | 100 | struct avcs_cmdrsp_get_fwk_version *fwk; |
|---|
| 102 | | - int bytes; |
|---|
| 103 | 101 | |
|---|
| 104 | 102 | fwk = data->payload; |
|---|
| 105 | | - bytes = sizeof(*fwk) + fwk->num_services * |
|---|
| 106 | | - sizeof(fwk->svc_api_info[0]); |
|---|
| 107 | 103 | |
|---|
| 108 | | - core->fwk_version = kzalloc(bytes, GFP_ATOMIC); |
|---|
| 104 | + core->fwk_version = kmemdup(data->payload, |
|---|
| 105 | + struct_size(fwk, svc_api_info, |
|---|
| 106 | + fwk->num_services), |
|---|
| 107 | + GFP_ATOMIC); |
|---|
| 109 | 108 | if (!core->fwk_version) |
|---|
| 110 | 109 | return -ENOMEM; |
|---|
| 111 | | - |
|---|
| 112 | | - memcpy(core->fwk_version, data->payload, bytes); |
|---|
| 113 | 110 | |
|---|
| 114 | 111 | core->fwk_version_supported = true; |
|---|
| 115 | 112 | core->resp_received = true; |
|---|
| .. | .. |
|---|
| 118 | 115 | } |
|---|
| 119 | 116 | case AVCS_GET_VERSIONS_RSP: { |
|---|
| 120 | 117 | struct avcs_cmdrsp_get_version *v; |
|---|
| 121 | | - int len; |
|---|
| 122 | 118 | |
|---|
| 123 | 119 | v = data->payload; |
|---|
| 124 | 120 | |
|---|
| 125 | | - len = sizeof(*v) + v->num_services * sizeof(v->svc_api_info[0]); |
|---|
| 126 | | - |
|---|
| 127 | | - core->svc_version = kzalloc(len, GFP_ATOMIC); |
|---|
| 121 | + core->svc_version = kmemdup(data->payload, |
|---|
| 122 | + struct_size(v, svc_api_info, |
|---|
| 123 | + v->num_services), |
|---|
| 124 | + GFP_ATOMIC); |
|---|
| 128 | 125 | if (!core->svc_version) |
|---|
| 129 | 126 | return -ENOMEM; |
|---|
| 130 | | - |
|---|
| 131 | | - memcpy(core->svc_version, data->payload, len); |
|---|
| 132 | 127 | |
|---|
| 133 | 128 | core->get_version_supported = true; |
|---|
| 134 | 129 | core->resp_received = true; |
|---|
| .. | .. |
|---|
| 359 | 354 | return 0; |
|---|
| 360 | 355 | } |
|---|
| 361 | 356 | |
|---|
| 357 | +#ifdef CONFIG_OF |
|---|
| 362 | 358 | static const struct of_device_id q6core_device_id[] = { |
|---|
| 363 | 359 | { .compatible = "qcom,q6core" }, |
|---|
| 364 | 360 | {}, |
|---|
| 365 | 361 | }; |
|---|
| 366 | 362 | MODULE_DEVICE_TABLE(of, q6core_device_id); |
|---|
| 363 | +#endif |
|---|
| 367 | 364 | |
|---|
| 368 | 365 | static struct apr_driver qcom_q6core_driver = { |
|---|
| 369 | 366 | .probe = q6core_probe, |
|---|