Merge "dsp: fix NULL pointer exception in core driver"
diff --git a/dsp/q6core.c b/dsp/q6core.c
index 5e09faa..c5b6409 100644
--- a/dsp/q6core.c
+++ b/dsp/q6core.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -108,8 +108,7 @@
*/
ver_size = sizeof(struct avcs_get_fwk_version) +
num_services * sizeof(struct avs_svc_api_info);
- if (q6core_lcl.q6core_avcs_ver_info.ver_info != NULL)
- pr_warn("%s: Version info is not NULL\n", __func__);
+
q6core_lcl.q6core_avcs_ver_info.ver_info =
kzalloc(ver_size, GFP_ATOMIC);
if (q6core_lcl.q6core_avcs_ver_info.ver_info == NULL)
@@ -236,12 +235,16 @@
pr_debug("%s: Received AVCS_CMDRSP_GET_FWK_VERSION\n",
__func__);
payload1 = data->payload;
- q6core_lcl.q6core_avcs_ver_info.status = VER_QUERY_SUPPORTED;
- q6core_lcl.avcs_fwk_ver_resp_received = 1;
ret = parse_fwk_version_info(payload1);
- if (ret < 0)
+ if (ret < 0) {
+ q6core_lcl.adsp_status = ret;
pr_err("%s: Failed to parse payload:%d\n",
__func__, ret);
+ } else {
+ q6core_lcl.q6core_avcs_ver_info.status =
+ VER_QUERY_SUPPORTED;
+ }
+ q6core_lcl.avcs_fwk_ver_resp_received = 1;
wake_up(&q6core_lcl.avcs_fwk_ver_req_wait);
break;
default:
@@ -441,8 +444,14 @@
if (ret)
goto done;
- num_services = q6core_lcl.q6core_avcs_ver_info.ver_info
- ->avcs_fwk_version.num_services;
+ if (q6core_lcl.q6core_avcs_ver_info.ver_info != NULL) {
+ num_services = q6core_lcl.q6core_avcs_ver_info.ver_info
+ ->avcs_fwk_version.num_services;
+ } else {
+ pr_err("%s: ver_info is NULL\n", __func__);
+ ret = -EINVAL;
+ goto done;
+ }
ret = sizeof(struct avcs_get_fwk_version);
if (service_id == AVCS_SERVICE_ID_ALL)