diff mbox series

spi: pic32: Don't leak DMA channels in probe error path

Message ID 9624250e3a7aa61274b38219a62375bac1def637.1604874488.git.lukas@wunner.de (mailing list archive)
State Accepted
Commit c575e9113bff5e024d75481613faed5ef9d465b2
Headers show
Series spi: pic32: Don't leak DMA channels in probe error path | expand

Commit Message

Lukas Wunner Nov. 8, 2020, 10:41 p.m. UTC
If the calls to devm_request_irq() or devm_spi_register_master() fail
on probe of the PIC32 SPI driver, the DMA channels requested by
pic32_spi_dma_prep() are erroneously not released.  Plug the leak.

Fixes: 1bcb9f8ceb67 ("spi: spi-pic32: Add PIC32 SPI master driver")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v4.7+
Cc: Purna Chandra Mandal <purna.mandal@microchip.com>
---
 drivers/spi/spi-pic32.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Brown Nov. 12, 2020, 7:39 p.m. UTC | #1
On Sun, 8 Nov 2020 23:41:00 +0100, Lukas Wunner wrote:
> If the calls to devm_request_irq() or devm_spi_register_master() fail
> on probe of the PIC32 SPI driver, the DMA channels requested by
> pic32_spi_dma_prep() are erroneously not released.  Plug the leak.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: pic32: Don't leak DMA channels in probe error path
      commit: c575e9113bff5e024d75481613faed5ef9d465b2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index 156961b4ca86..104bde153efd 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -839,6 +839,7 @@  static int pic32_spi_probe(struct platform_device *pdev)
 	return 0;
 
 err_bailout:
+	pic32_spi_dma_unprep(pic32s);
 	clk_disable_unprepare(pic32s->clk);
 err_master:
 	spi_master_put(master);