diff mbox

[1/1] Intel: ASoC: Add condition check before set param to waves

Message ID 1426725480-31645-1-git-send-email-han.lu@intel.com (mailing list archive)
State Accepted
Commit 5d5b275d727753372f0a390b4121738d073f3e94
Headers show

Commit Message

han.lu@intel.com March 19, 2015, 12:38 a.m. UTC
From: "Lu, Han" <han.lu@intel.com>

Check waves state before set parameter through ipc to prevent unexpected
operation. Also remove redundant check.

Signed-off-by: Lu, Han <han.lu@intel.com>

Comments

Mark Brown March 19, 2015, 12:49 a.m. UTC | #1
On Thu, Mar 19, 2015 at 08:38:00AM +0800, han.lu@intel.com wrote:
> From: "Lu, Han" <han.lu@intel.com>
> 
> Check waves state before set parameter through ipc to prevent unexpected
> operation. Also remove redundant check.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index 43fb5f3..20b629a 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -2055,6 +2055,11 @@  int sst_hsw_launch_param_buf(struct sst_hsw *hsw)
 {
 	int ret, idx;
 
+	if (!sst_hsw_is_module_active(hsw, SST_HSW_MODULE_WAVES)) {
+		dev_dbg(hsw->dev, "module waves is not active\n");
+		return 0;
+	}
+
 	/* put all param lines to DSP through ipc */
 	for (idx = 0; idx < hsw->param_idx_w; idx++) {
 		ret = sst_hsw_module_set_param(hsw,
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c
index b40ec74..6c6229a 100644
--- a/sound/soc/intel/sst-haswell-pcm.c
+++ b/sound/soc/intel/sst-haswell-pcm.c
@@ -399,13 +399,9 @@  static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
 	if (ret < 0)
 		return ret;
 
-	if (sst_hsw_is_module_loaded(hsw, id)) {
-		if (!sst_hsw_is_module_active(hsw, id))
-			return 0;
-
+	if (sst_hsw_is_module_active(hsw, id))
 		ret = sst_hsw_module_set_param(hsw, id, 0, param_id,
 				param_size, ucontrol->value.bytes.data);
-	}
 	return ret;
 }