hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/sound/soc/qcom/qdsp6/q6core.c
....@@ -10,7 +10,6 @@
1010 #include <linux/of.h>
1111 #include <linux/of_platform.h>
1212 #include <linux/jiffies.h>
13
-#include <linux/wait.h>
1413 #include <linux/soc/qcom/apr.h>
1514 #include "q6core.h"
1615 #include "q6dsp-errno.h"
....@@ -99,17 +98,15 @@
9998 }
10099 case AVCS_CMDRSP_GET_FWK_VERSION: {
101100 struct avcs_cmdrsp_get_fwk_version *fwk;
102
- int bytes;
103101
104102 fwk = data->payload;
105
- bytes = sizeof(*fwk) + fwk->num_services *
106
- sizeof(fwk->svc_api_info[0]);
107103
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);
109108 if (!core->fwk_version)
110109 return -ENOMEM;
111
-
112
- memcpy(core->fwk_version, data->payload, bytes);
113110
114111 core->fwk_version_supported = true;
115112 core->resp_received = true;
....@@ -118,17 +115,15 @@
118115 }
119116 case AVCS_GET_VERSIONS_RSP: {
120117 struct avcs_cmdrsp_get_version *v;
121
- int len;
122118
123119 v = data->payload;
124120
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);
128125 if (!core->svc_version)
129126 return -ENOMEM;
130
-
131
- memcpy(core->svc_version, data->payload, len);
132127
133128 core->get_version_supported = true;
134129 core->resp_received = true;
....@@ -359,11 +354,13 @@
359354 return 0;
360355 }
361356
357
+#ifdef CONFIG_OF
362358 static const struct of_device_id q6core_device_id[] = {
363359 { .compatible = "qcom,q6core" },
364360 {},
365361 };
366362 MODULE_DEVICE_TABLE(of, q6core_device_id);
363
+#endif
367364
368365 static struct apr_driver qcom_q6core_driver = {
369366 .probe = q6core_probe,