spi: bcm2835: Release the DMA channel if probe fails after dma_init
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Thu, 12 Dec 2019 13:55:43 +0000 (15:55 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 16 Dec 2019 11:56:27 +0000 (11:56 +0000)
The DMA channel was not released if either devm_request_irq() or
devm_spi_register_controller() failed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20191212135550.4634-3-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-bcm2835.c

index fb61a620effc54d49afbfcd09b3a59c7e8fedd2e..662d55e9f21d18f576c67b4bf2216779668729e3 100644 (file)
@@ -1327,20 +1327,22 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
                               dev_name(&pdev->dev), ctlr);
        if (err) {
                dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
-               goto out_clk_disable;
+               goto out_dma_release;
        }
 
        err = devm_spi_register_controller(&pdev->dev, ctlr);
        if (err) {
                dev_err(&pdev->dev, "could not register SPI controller: %d\n",
                        err);
-               goto out_clk_disable;
+               goto out_dma_release;
        }
 
        bcm2835_debugfs_create(bs, dev_name(&pdev->dev));
 
        return 0;
 
+out_dma_release:
+       bcm2835_dma_release(ctlr, bs);
 out_clk_disable:
        clk_disable_unprepare(bs->clk);
 out_controller_put: