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

Commit 01e31721 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: Fix range check logic of port index"

parents 6b46ac21 811f1faa
Loading
Loading
Loading
Loading
+35 −35
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ int afe_get_topology(int port_id)
	int topology;
	int port_index = afe_get_port_index(port_id);

	if ((port_index < 0) || (port_index > AFE_MAX_PORTS)) {
	if ((port_index < 0) || (port_index >= AFE_MAX_PORTS)) {
		pr_err("%s: Invalid port index %d\n", __func__, port_index);
		topology = -EINVAL;
		goto done;
@@ -726,7 +726,7 @@ static int afe_send_cal_block(u16 port_id, struct cal_block_data *cal_block)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		result = -EINVAL;
@@ -870,7 +870,7 @@ static int afe_spk_ramp_dn_cfg(int port)
		goto fail_cmd;
	}
	index = q6audio_get_port_index(port);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
@@ -951,7 +951,7 @@ static int afe_spk_prot_prepare(int src_port, int dst_port, int param_id,
		goto fail_cmd;
	}
	index = q6audio_get_port_index(src_port);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
@@ -1196,7 +1196,7 @@ static int afe_send_hw_delay(u16 port_id, u32 rate)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
@@ -1318,7 +1318,7 @@ static int afe_send_port_topology_id(u16 port_id)
	u32 topology_id = 0;

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS - 1) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -1675,7 +1675,7 @@ static int afe_send_slimbus_slave_port_cfg(

	pr_debug("%s: enter, port_id =  0x%x\n", __func__, port_id);
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -1729,7 +1729,7 @@ static int afe_aanc_port_cfg(void *apr, uint16_t tx_port, uint16_t rx_port)
	}

	index = q6audio_get_port_index(tx_port);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -1814,7 +1814,7 @@ static int afe_aanc_mod_enable(void *apr, uint16_t tx_port, uint16_t enable)
	}

	index = q6audio_get_port_index(tx_port);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2036,7 +2036,7 @@ int afe_send_spdif_clk_cfg(struct afe_param_id_spdif_clk_cfg *cfg,
		return ret;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2122,7 +2122,7 @@ int afe_send_spdif_ch_status_cfg(struct afe_param_id_spdif_ch_status_cfg
		return ret;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2196,7 +2196,7 @@ static int afe_send_cmd_port_start(u16 port_id)

	pr_debug("%s: enter\n", __func__);
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2267,7 +2267,7 @@ int afe_spdif_port_start(u16 port_id, struct afe_spdif_port_config *spdif_port,
	pr_debug("%s: port id: 0x%x\n", __func__, port_id);

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2342,7 +2342,7 @@ int afe_send_slot_mapping_cfg(
	pr_debug("%s: port id: 0x%x\n", __func__, port_id);

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2421,7 +2421,7 @@ int afe_send_custom_tdm_header_cfg(
	pr_debug("%s: port id: 0x%x\n", __func__, port_id);

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2501,7 +2501,7 @@ int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
	pr_debug("%s: port id: 0x%x\n", __func__, port_id);

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -2623,7 +2623,7 @@ int afe_port_send_usb_dev_param(u16 port_id, union afe_port_config *afe_config)
		goto exit;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid! for port ID 0x%x\n",
				__func__, index, port_id);
		ret = -EINVAL;
@@ -2824,7 +2824,7 @@ static int __afe_port_start(u16 port_id, union afe_port_config *afe_config,
	pr_debug("%s: port id: 0x%x\n", __func__, port_id);

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -3383,7 +3383,7 @@ int afe_open(u16 port_id,
	pr_err("%s: port_id 0x%x rate %d\n", __func__, port_id, rate);

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -3551,7 +3551,7 @@ int afe_loopback(u16 enable, u16 rx_port, u16 tx_port)
	}

	index = q6audio_get_port_index(rx_port);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -3617,7 +3617,7 @@ int afe_loopback_gain(u16 port_id, u16 volume)
		goto fail_cmd;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -3720,7 +3720,7 @@ int afe_start_pseudo_port(u16 port_id)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -3763,7 +3763,7 @@ int afe_pseudo_port_stop_nowait(u16 port_id)
		return -EINVAL;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -3924,7 +3924,7 @@ int afe_stop_pseudo_port(u16 port_id)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -4213,7 +4213,7 @@ int afe_cmd_memory_map_nowait(int port_id, phys_addr_t dma_addr_p,
		rtac_set_afe_handle(this_afe.apr);
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -4477,7 +4477,7 @@ int afe_unregister_get_events(u16 port_id)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -4821,7 +4821,7 @@ int afe_dtmf_generate_rx(int64_t duration_in_ms,
		goto fail_cmd;
	}
	index = q6audio_get_port_index(this_afe.dtmf_gen_rx_portid);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
@@ -5059,7 +5059,7 @@ int afe_sidetone_enable(u16 tx_port_id, u16 rx_port_id, bool enable)
	int index;

	index = q6audio_get_port_index(rx_port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
@@ -5072,7 +5072,7 @@ int afe_sidetone_enable(u16 tx_port_id, u16 rx_port_id, bool enable)
		goto done;
	}
	index = q6audio_get_port_index(tx_port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
@@ -5367,7 +5367,7 @@ int afe_close(int port_id)

	port_id = q6audio_convert_virtual_to_portid(port_id);
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -5525,7 +5525,7 @@ int afe_set_lpass_clock(u16 port_id, struct afe_clk_cfg *cfg)
		return ret;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -5691,7 +5691,7 @@ int afe_set_lpass_clock_v2(u16 port_id, struct afe_clk_set *cfg)
	int ret = 0;

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -5724,7 +5724,7 @@ int afe_set_lpass_internal_digital_codec_clock(u16 port_id,
		return ret;
	}
	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -5805,7 +5805,7 @@ int afe_enable_lpass_core_shared_clock(u16 port_id, u32 enable)
	int ret = 0;

	index = q6audio_get_port_index(port_id);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		return -EINVAL;
@@ -6084,7 +6084,7 @@ int afe_spk_prot_get_calib_data(struct afe_spkr_prot_get_vi_calib *calib_resp)
		goto fail_cmd;
	}
	index = q6audio_get_port_index(port);
	if (index < 0 || index > AFE_MAX_PORTS) {
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;