This is a note to let you know that I've just added the patch titled spi: imx: Fix freeing of DMA channels if spi_bitbang_start() fails to the 5.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: spi-imx-fix-freeing-of-dma-channels-if-spi_bitbang_s.patch and it can be found in the queue-5.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 83eb954cf6ba4c336adf0f11d4393d5cee78d3b1 Author: Marek Vasut <marex@xxxxxxx> Date: Mon Oct 5 15:22:29 2020 +0200 spi: imx: Fix freeing of DMA channels if spi_bitbang_start() fails [ Upstream commit 45f0bbdafd26d6d772172563b30bff561cec9133 ] If the SPI controller has has_dmamode = true and spi_bitbang_start() fails in spi_imx_probe(), then the driver must release the DMA channels acquired in spi_imx_sdma_init() by calling spi_imx_sdma_exit() in the fail path. Fixes: f62caccd12c1 ("spi: spi-imx: add DMA support") Signed-off-by: Marek Vasut <marex@xxxxxxx> Cc: Fabio Estevam <festevam@xxxxxxxxx> Cc: Mark Brown <broonie@xxxxxxxxxx> Cc: NXP Linux Team <linux-imx@xxxxxxx> Cc: Robin Gong <b38343@xxxxxxxxxxxxx> Cc: Shawn Guo <shawnguo@xxxxxxxxxx> Link: https://lore.kernel.org/r/20201005132229.513119-1-marex@xxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 38a5f1304cec4..e38e5ad3c7068 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1707,7 +1707,7 @@ static int spi_imx_probe(struct platform_device *pdev) ret = spi_bitbang_start(&spi_imx->bitbang); if (ret) { dev_err(&pdev->dev, "bitbang start failed with %d\n", ret); - goto out_runtime_pm_put; + goto out_bitbang_start; } dev_info(&pdev->dev, "probed\n"); @@ -1717,6 +1717,9 @@ static int spi_imx_probe(struct platform_device *pdev) return ret; +out_bitbang_start: + if (spi_imx->devtype_data->has_dmamode) + spi_imx_sdma_exit(spi_imx); out_runtime_pm_put: pm_runtime_dont_use_autosuspend(spi_imx->dev); pm_runtime_put_sync(spi_imx->dev);