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

Commit 9aa03b07 authored by Alexy Joseph's avatar Alexy Joseph Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: avoid setting DTS HPX param on invalid copp



Check for copp index validity before setting DTS HPX param
on it.

Change-Id: Ied811e4a6bdaa88147c118201b77a90666bda9e3
Signed-off-by: default avatarAlexy Joseph <alexyj@codeaurora.org>
parent 700e0c78
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, 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
@@ -238,8 +238,14 @@ int adm_dts_eagle_set(int port_id, int copp_idx, int param_id,
		__func__, port_id, p_idx);

	if (p_idx < 0) {
		pr_err("DTS_EAGLE_ADM: %s - invalid port index %i, port id %i, copp idx %i\n",
			__func__, p_idx, port_id, copp_idx);
		pr_err("DTS_EAGLE_ADM: %s: invalid port index 0x%x, port id 0x%x\n",
			__func__, p_idx, port_id);
		return -EINVAL;
	}

	if (copp_idx < 0 || copp_idx >= MAX_COPPS_PER_PORT) {
		pr_err("DTS_EAGLE_ADM: %s: Invalid copp_idx: %d\n", __func__,
			copp_idx);
		return -EINVAL;
	}

@@ -323,6 +329,12 @@ int adm_dts_eagle_get(int port_id, int copp_idx, int param_id,
		return -EINVAL;
	}

	if (copp_idx < 0 || copp_idx >= MAX_COPPS_PER_PORT) {
		pr_err("DTS_EAGLE_ADM: %s: Invalid copp_idx: %d\n", __func__,
			copp_idx);
		return -EINVAL;
	}

	if (size <= 0 || !data) {
		pr_err("DTS_EAGLE_ADM: %s - invalid size %i or pointer %p.\n",
			__func__, size, data);