* [PATCH] soundwire: qcom: add proper error paths in qcom_swrm_startup()
@ 2023-05-17 16:37 Krzysztof Kozlowski
2023-05-17 16:45 ` Pierre-Louis Bossart
2023-05-27 10:40 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-17 16:37 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Vinod Koul,
Bard Liao, Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm,
alsa-devel, linux-kernel
Cc: Krzysztof Kozlowski
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>
---
drivers/soundwire/qcom.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index f442280af9d3..baaa75320ae3 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1208,8 +1208,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;
@@ -1219,12 +1221,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,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soundwire: qcom: add proper error paths in qcom_swrm_startup()
2023-05-17 16:37 [PATCH] soundwire: qcom: add proper error paths in qcom_swrm_startup() Krzysztof Kozlowski
@ 2023-05-17 16:45 ` Pierre-Louis Bossart
2023-05-27 10:40 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2023-05-17 16:45 UTC (permalink / raw)
To: Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Vinod Koul, Bard Liao, Sanyog Kale, linux-arm-msm, alsa-devel,
linux-kernel
On 5/17/23 11:37, Krzysztof Kozlowski wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soundwire: qcom: add proper error paths in qcom_swrm_startup()
2023-05-17 16:37 [PATCH] soundwire: qcom: add proper error paths in qcom_swrm_startup() Krzysztof Kozlowski
2023-05-17 16:45 ` Pierre-Louis Bossart
@ 2023-05-27 10:40 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-05-27 10:40 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Bard Liao,
Pierre-Louis Bossart, Sanyog Kale, linux-arm-msm, alsa-devel,
linux-kernel
On 17-05-23, 18:37, Krzysztof Kozlowski wrote:
> Reverse actions in qcom_swrm_startup() error paths to avoid leaking
> stream memory and keeping runtime PM unbalanced.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-27 10:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 16:37 [PATCH] soundwire: qcom: add proper error paths in qcom_swrm_startup() Krzysztof Kozlowski
2023-05-17 16:45 ` Pierre-Louis Bossart
2023-05-27 10:40 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.