ASoc: msm: Add pm_qos_request_active condition check

Add pm_qos_request_active() status check before pm_qos_remove_request()
to avoid illegal remove behavior.

CRs-Fixed: 2069618
Change-Id: I45cf767fa5f0c51773c0dc67e03da81eb723d34f
Signed-off-by: Cong Tang <congt@codeaurora.org>
This commit is contained in:
Cong Tang 2017-07-24 17:47:11 +08:00 committed by Gerrit - the friendly Code Review server
parent 977b2f7055
commit 8a366c6206
2 changed files with 7 additions and 3 deletions

View file

@ -654,7 +654,9 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream)
if (substream->ops->hw_free)
result = substream->ops->hw_free(substream);
snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
pm_qos_remove_request(&substream->latency_pm_qos_req);
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);
return result;
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 2017 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
@ -25,7 +25,9 @@ static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
pr_err("%s: invalid params\n", __func__);
return -EINVAL;
}
pm_qos_remove_request(&substream->latency_pm_qos_req);
if (pm_qos_request_active(&substream->latency_pm_qos_req))
pm_qos_remove_request(&substream->latency_pm_qos_req);
return 0;
}