diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index b99de8c4cc99..c9442326782c 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c @@ -2502,7 +2502,7 @@ static int stm32_spi_probe(struct platform_device *pdev) spi->dma_rx = NULL; } else { dev_err_probe(&pdev->dev, ret, "failed to request rx dma channel\n"); - goto err_dma_release; + goto err_dma_tx_release; } } else { ctrl->dma_rx = spi->dma_rx; @@ -2571,11 +2571,11 @@ err_pool_free: if (spi->sram_pool) gen_pool_free(spi->sram_pool, (unsigned long)spi->sram_rx_buf, spi->sram_rx_buf_size); -err_dma_release: - if (spi->dma_tx) - dma_release_channel(spi->dma_tx); if (spi->dma_rx) dma_release_channel(spi->dma_rx); +err_dma_tx_release: + if (spi->dma_tx) + dma_release_channel(spi->dma_tx); err_clk_disable: clk_disable_unprepare(spi->clk);