mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
soundwire: qcom: add proper error paths in qcom_swrm_startup()
[ Upstream commit 99e09b9c0a
]
Reverse actions in qcom_swrm_startup() error paths to avoid leaking
stream memory and keeping runtime PM unbalanced.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230517163736.997553-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
2839e0b64e
commit
5cc506e9b3
1 changed files with 13 additions and 4 deletions
|
@ -1090,8 +1090,10 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream,
|
|||
}
|
||||
|
||||
sruntime = sdw_alloc_stream(dai->name);
|
||||
if (!sruntime)
|
||||
return -ENOMEM;
|
||||
if (!sruntime) {
|
||||
ret = -ENOMEM;
|
||||
goto err_alloc;
|
||||
}
|
||||
|
||||
ctrl->sruntime[dai->id] = sruntime;
|
||||
|
||||
|
@ -1101,12 +1103,19 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream,
|
|||
if (ret < 0 && ret != -ENOTSUPP) {
|
||||
dev_err(dai->dev, "Failed to set sdw stream on %s\n",
|
||||
codec_dai->name);
|
||||
sdw_release_stream(sruntime);
|
||||
return ret;
|
||||
goto err_set_stream;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_set_stream:
|
||||
sdw_release_stream(sruntime);
|
||||
err_alloc:
|
||||
pm_runtime_mark_last_busy(ctrl->dev);
|
||||
pm_runtime_put_autosuspend(ctrl->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void qcom_swrm_shutdown(struct snd_pcm_substream *substream,
|
||||
|
|
Loading…
Reference in a new issue