[PATCH] ASoC: mmp-sspa: Fix runtime PM refcount leak in mmp_sspa_open()
laixiangwu
laixiangwu at cmss.chinamobile.com
Fri Oct 30 01:38:10 PDT 2026
mmp_sspa_open() calls pm_runtime_get_sync() to power up the device,
but when the port is found to be in use it returns -EBUSY without the
matching pm_runtime_put_sync().
The ASoC core only invokes the component close() callback (which would
drop the reference) for streams whose open() succeeded, so every
rejected open leaves the runtime PM usage counter incremented and the
device can never runtime suspend afterwards.
Drop the reference on the error path, and also check the return value
of pm_runtime_get_sync() as the ASoC core itself does.
Fixes: 7d98cc648253 ("ASoC: mmp-sspa: Add support for the runtime power management")
Signed-off-by: laixiangwu <laixiangwu at cmss.chinamobile.com>
---
sound/soc/pxa/mmp-sspa.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index f9066fbdd..eee15a6cf 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -421,14 +421,20 @@ static int mmp_sspa_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct sspa_priv *sspa = snd_soc_component_get_drvdata(component);
+ int ret;
- pm_runtime_get_sync(component->dev);
+ ret = pm_runtime_get_sync(component->dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(component->dev);
+ return ret;
+ }
/* we can only change the settings if the port is not in use */
if ((__raw_readl(sspa->tx_base + SSPA_SP) & SSPA_SP_S_EN) ||
(__raw_readl(sspa->rx_base + SSPA_SP) & SSPA_SP_S_EN)) {
dev_err(component->dev,
"can't change hardware dai format: stream is in use\n");
+ pm_runtime_put_sync(component->dev);
return -EBUSY;
}
More information about the linux-arm-kernel
mailing list