Revert "ASoc: msm: Improve error checking in code"
This reverts commit 09dc65f37f131c7d8ddbfa083d63863ca79c4fc1.
The reverted commit causes crashes for normal WMA playback
Change-Id: I7cf8ea770a7783c74fc3b066fce4297f2ba018bc
Signed-off-by: Mingming Yin <mingming@codeaurora.org>
diff --git a/sound/soc/msm/qdsp6/q6adm.c b/sound/soc/msm/qdsp6/q6adm.c
index 3745b17..676ecf1 100644
--- a/sound/soc/msm/qdsp6/q6adm.c
+++ b/sound/soc/msm/qdsp6/q6adm.c
@@ -143,14 +143,14 @@
s32 result = 0;
struct adm_set_params_command adm_params;
int index = afe_get_port_index(port_id);
-
- pr_debug("%s: Port id %d, index %d\n", __func__, port_id, index);
-
if (index < 0 || index >= AFE_MAX_PORTS) {
pr_err("%s: invalid port idx %d portid %d\n",
__func__, index, port_id);
- goto done;
+ return 0;
}
+
+ pr_debug("%s: Port id %d, index %d\n", __func__, port_id, index);
+
if (!aud_cal || aud_cal->cal_size == 0) {
pr_debug("%s: No ADM cal to send for port_id = %d!\n",
__func__, port_id);
@@ -580,16 +580,15 @@
int ret = 0, i = 0;
/* Assumes port_ids have already been validated during adm_open */
int index = afe_get_port_index(copp_id);
+ if (index < 0 || index >= AFE_MAX_PORTS) {
+ pr_err("%s: invalid port idx %d token %d\n",
+ __func__, index, copp_id);
+ return 0;
+ }
pr_debug("%s: session 0x%x path:%d num_copps:%d port_id[0]:%d\n",
__func__, session_id, path, num_copps, port_id[0]);
- if (index < 0 || index >= AFE_MAX_PORTS) {
- pr_err("%s: invalid port idx %d token %d\n",
- __func__, index, copp_id);
- ret = -EINVAL;
- goto fail_cmd;
- }
route.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
route.hdr.pkt_size = sizeof(route);
@@ -614,7 +613,7 @@
pr_debug("%s: port_id[%d]: %d, index: %d\n", __func__, i,
port_id[i], tmp);
- if ((tmp >= 0) && (tmp < AFE_MAX_PORTS))
+ if (tmp >= 0 && tmp < AFE_MAX_PORTS)
route.session[0].copp_id[i] =
atomic_read(&this_adm.copp_id[tmp]);
}