mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
spi: qup: Don't skip cleanup in remove's error path
[ Upstream commit61f49171a4
] Returning early in a platform driver's remove callback is wrong. In this case the dma resources are not released in the error path. this is never retried later and so this is a permanent leak. To fix this, only skip hardware disabling if waking the device fails. Fixes:64ff247a97
("spi: Add Qualcomm QUP SPI controller support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230330210341.2459548-2-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
77b0c0dd2c
commit
f345d4d71e
1 changed files with 13 additions and 9 deletions
|
@ -1276,19 +1276,23 @@ static int spi_qup_remove(struct platform_device *pdev)
|
|||
struct spi_qup *controller = spi_master_get_devdata(master);
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_resume_and_get(&pdev->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = pm_runtime_get_sync(&pdev->dev);
|
||||
|
||||
ret = spi_qup_set_state(controller, QUP_STATE_RESET);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (ret >= 0) {
|
||||
ret = spi_qup_set_state(controller, QUP_STATE_RESET);
|
||||
if (ret)
|
||||
dev_warn(&pdev->dev, "failed to reset controller (%pe)\n",
|
||||
ERR_PTR(ret));
|
||||
|
||||
clk_disable_unprepare(controller->cclk);
|
||||
clk_disable_unprepare(controller->iclk);
|
||||
} else {
|
||||
dev_warn(&pdev->dev, "failed to resume, skip hw disable (%pe)\n",
|
||||
ERR_PTR(ret));
|
||||
}
|
||||
|
||||
spi_qup_release_dma(master);
|
||||
|
||||
clk_disable_unprepare(controller->cclk);
|
||||
clk_disable_unprepare(controller->iclk);
|
||||
|
||||
pm_runtime_put_noidle(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
|
|
Loading…
Reference in a new issue