Commit 1dcbdd94 authored by Zhang Qilong's avatar Zhang Qilong Committed by Mark Brown

spi: imx: fix reference leak in two imx operations

pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference leak in callers(spi_imx_prepare_message and
spi_imx_remove), so we should fix it.

Fixes: 525c9e5a ("spi: imx: enable runtime pm support")
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201102145835.4765-1-zhangqilong3@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0e685017
......@@ -1538,6 +1538,7 @@ spi_imx_prepare_message(struct spi_master *master, struct spi_message *msg)
ret = pm_runtime_get_sync(spi_imx->dev);
if (ret < 0) {
pm_runtime_put_noidle(spi_imx->dev);
dev_err(spi_imx->dev, "failed to enable clock\n");
return ret;
}
......@@ -1747,6 +1748,7 @@ static int spi_imx_remove(struct platform_device *pdev)
ret = pm_runtime_get_sync(spi_imx->dev);
if (ret < 0) {
pm_runtime_put_noidle(spi_imx->dev);
dev_err(spi_imx->dev, "failed to enable clock\n");
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment