ASoC: sh: rz-ssi: Release the DMA channels in rz_ssi_probe() error path

[ Upstream commit 767e6f2620 ]

DMA channels requested by rz_ssi_dma_request() in rz_ssi_probe() were
never released in the error path apart from one place. This patch fixes
this issue by calling rz_ssi_release_dma_channels() in the error path.

Fixes: 26ac471c53 ("ASoC: sh: rz-ssi: Add SSI DMAC support")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20220426074922.13319-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Lad Prabhakar 2022-04-26 08:49:22 +01:00 committed by Greg Kroah-Hartman
parent b7c13643e1
commit cff2553569

View File

@ -982,14 +982,18 @@ static int rz_ssi_probe(struct platform_device *pdev)
/* Error Interrupt */ /* Error Interrupt */
ssi->irq_int = platform_get_irq_byname(pdev, "int_req"); ssi->irq_int = platform_get_irq_byname(pdev, "int_req");
if (ssi->irq_int < 0) if (ssi->irq_int < 0) {
rz_ssi_release_dma_channels(ssi);
return ssi->irq_int; return ssi->irq_int;
}
ret = devm_request_irq(&pdev->dev, ssi->irq_int, &rz_ssi_interrupt, ret = devm_request_irq(&pdev->dev, ssi->irq_int, &rz_ssi_interrupt,
0, dev_name(&pdev->dev), ssi); 0, dev_name(&pdev->dev), ssi);
if (ret < 0) if (ret < 0) {
rz_ssi_release_dma_channels(ssi);
return dev_err_probe(&pdev->dev, ret, return dev_err_probe(&pdev->dev, ret,
"irq request error (int_req)\n"); "irq request error (int_req)\n");
}
if (!rz_ssi_is_dma_enabled(ssi)) { if (!rz_ssi_is_dma_enabled(ssi)) {
/* Tx and Rx interrupts (pio only) */ /* Tx and Rx interrupts (pio only) */
@ -1017,13 +1021,16 @@ static int rz_ssi_probe(struct platform_device *pdev)
} }
ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); ssi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
if (IS_ERR(ssi->rstc)) if (IS_ERR(ssi->rstc)) {
rz_ssi_release_dma_channels(ssi);
return PTR_ERR(ssi->rstc); return PTR_ERR(ssi->rstc);
}
reset_control_deassert(ssi->rstc); reset_control_deassert(ssi->rstc);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
ret = pm_runtime_resume_and_get(&pdev->dev); ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) { if (ret < 0) {
rz_ssi_release_dma_channels(ssi);
pm_runtime_disable(ssi->dev); pm_runtime_disable(ssi->dev);
reset_control_assert(ssi->rstc); reset_control_assert(ssi->rstc);
return dev_err_probe(ssi->dev, ret, "pm_runtime_resume_and_get failed\n"); return dev_err_probe(ssi->dev, ret, "pm_runtime_resume_and_get failed\n");