Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c4c1f05 authored by Puja Gupta's avatar Puja Gupta
Browse files

soc: qcom: Fix checks for QMI response values



The return values from QMI could be compared directly and was
incorrectly interpreted in service locator and notifier.

Also initialize structure in service locator so as to not have garbage
values in them.

CRs-Fixed: 2044241
Change-Id: I7f8f27857706e9508b64289d9263c79494c17a8d
Signed-off-by: default avatarPuja Gupta <pujag@codeaurora.org>
parent 7574ff02
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@

#define SERVREG_LOC_SERVICE_INSTANCE_ID			1

#define QMI_RESP_BIT_SHIFT(x)				(x << 16)
#define QMI_SERVREG_LOC_SERVER_INITIAL_TIMEOUT		2000
#define QMI_SERVREG_LOC_SERVER_TIMEOUT			2000
#define INITIAL_TIMEOUT					100000
@@ -199,9 +198,9 @@ static int servreg_loc_send_msg(struct msg_desc *req_desc,
	}

	/* Check the response */
	if (QMI_RESP_BIT_SHIFT(resp->resp.result) != QMI_RESULT_SUCCESS_V01) {
	if (resp->resp.result != QMI_RESULT_SUCCESS_V01) {
		pr_err("QMI request for client %s failed 0x%x\n",
			pd->client_name, QMI_RESP_BIT_SHIFT(resp->resp.error));
			pd->client_name, resp->resp.error);
		return -EREMOTEIO;
	}
	return rc;
@@ -220,7 +219,7 @@ static int service_locator_send_msg(struct pd_qmi_client_data *pd)
		return -EAGAIN;
	}

	req = kmalloc(sizeof(
	req = kzalloc(sizeof(
		struct qmi_servreg_loc_get_domain_list_req_msg_v01),
		GFP_KERNEL);
	if (!req) {
@@ -228,7 +227,7 @@ static int service_locator_send_msg(struct pd_qmi_client_data *pd)
		rc = -ENOMEM;
		goto out;
	}
	resp = kmalloc(sizeof(
	resp = kzalloc(sizeof(
		struct qmi_servreg_loc_get_domain_list_resp_msg_v01),
		GFP_KERNEL);
	if (!resp) {
+9 −12
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <soc/qcom/service-notifier.h>
#include "service-notifier-private.h"

#define QMI_RESP_BIT_SHIFT(x)			(x << 16)
#define SERVREG_NOTIF_NAME_LENGTH	QMI_SERVREG_NOTIF_NAME_LENGTH_V01
#define SERVREG_NOTIF_SERVICE_ID	SERVREG_NOTIF_SERVICE_ID_V01
#define SERVREG_NOTIF_SERVICE_VERS	SERVREG_NOTIF_SERVICE_VERS_V01
@@ -225,9 +224,8 @@ static void send_ind_ack(struct work_struct *work)
	}

	/* Check the response */
	if (QMI_RESP_BIT_SHIFT(resp.resp.result) != QMI_RESULT_SUCCESS_V01)
		pr_err("QMI request failed 0x%x\n",
			QMI_RESP_BIT_SHIFT(resp.resp.error));
	if (resp.resp.result != QMI_RESULT_SUCCESS_V01)
		pr_err("QMI request failed 0x%x\n", resp.resp.error);
	pr_info("Indication ACKed for transid %d, service %s, instance %d!\n",
		data->ind_msg.transaction_id, data->ind_msg.service_path,
		data->instance_id);
@@ -318,9 +316,8 @@ static int send_notif_listener_msg_req(struct service_notif_info *service_notif,
	}

	/* Check the response */
	if (QMI_RESP_BIT_SHIFT(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
		pr_err("QMI request failed 0x%x\n",
					QMI_RESP_BIT_SHIFT(resp.resp.error));
	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
		pr_err("QMI request failed 0x%x\n", resp.resp.error);
		return -EREMOTEIO;
	}

@@ -646,15 +643,15 @@ static int send_pd_restart_req(const char *service_path,
	}

	/* Check response if PDR is disabled */
	if (QMI_RESP_BIT_SHIFT(resp.resp.result) == QMI_ERR_DISABLED_V01) {
		pr_err("PD restart is disabled 0x%x\n",
					QMI_RESP_BIT_SHIFT(resp.resp.error));
	if (resp.resp.result == QMI_RESULT_FAILURE_V01 &&
				resp.resp.error == QMI_ERR_DISABLED_V01) {
		pr_err("PD restart is disabled 0x%x\n", resp.resp.error);
		return -EOPNOTSUPP;
	}
	/* Check the response for other error case*/
	if (QMI_RESP_BIT_SHIFT(resp.resp.result) != QMI_RESULT_SUCCESS_V01) {
	if (resp.resp.result != QMI_RESULT_SUCCESS_V01) {
		pr_err("QMI request for PD restart failed 0x%x\n",
					QMI_RESP_BIT_SHIFT(resp.resp.error));
						resp.resp.error);
		return -EREMOTEIO;
	}

+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ enum qmi_result_type_v01 {
	QMI_RESULT_TYPE_MIN_ENUM_VAL_V01 = INT_MIN,
	QMI_RESULT_SUCCESS_V01 = 0,
	QMI_RESULT_FAILURE_V01 = 1,
	QMI_ERR_DISABLED_V01 = 0x45,
	QMI_RESULT_TYPE_MAX_ENUM_VAL_V01 = INT_MAX,
};

@@ -106,6 +105,7 @@ enum qmi_error_type_v01 {
	QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 = 0x0005,
	QMI_ERR_INVALID_ID_V01 = 0x0029,
	QMI_ERR_ENCODING_V01 = 0x003A,
	QMI_ERR_DISABLED_V01 = 0x0045,
	QMI_ERR_INCOMPATIBLE_STATE_V01 = 0x005A,
	QMI_ERR_NOT_SUPPORTED_V01 = 0x005E,
	QMI_ERR_TYPE_MAX_ENUM_VAL_V01 = INT_MAX,