Skip to content

Commit c266d19

Browse files
Alain Volmatbroonie
authored andcommitted
spi: stm32: properly fail on dma_request_chan error
Correct handling of the dma_request_chan call in order to avoid misleading warn message if no DMA is provided within the device-tree and moreover fail if dma_request_chan has returned a valid error. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Link: https://patch.msgid.link/20251218-stm32-spi-enhancements-v2-1-3b69901ca9fe@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 8f0b4cc commit c266d19

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

drivers/spi/spi-stm32.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,23 +2406,27 @@ static int stm32_spi_probe(struct platform_device *pdev)
24062406
spi->dma_tx = dma_request_chan(spi->dev, "tx");
24072407
if (IS_ERR(spi->dma_tx)) {
24082408
ret = PTR_ERR(spi->dma_tx);
2409-
spi->dma_tx = NULL;
2410-
if (ret == -EPROBE_DEFER)
2409+
if (ret == -ENODEV) {
2410+
dev_info(&pdev->dev, "tx dma disabled\n");
2411+
spi->dma_tx = NULL;
2412+
} else {
2413+
dev_err_probe(&pdev->dev, ret, "failed to request tx dma channel\n");
24112414
goto err_clk_disable;
2412-
2413-
dev_warn(&pdev->dev, "failed to request tx dma channel\n");
2415+
}
24142416
} else {
24152417
ctrl->dma_tx = spi->dma_tx;
24162418
}
24172419

24182420
spi->dma_rx = dma_request_chan(spi->dev, "rx");
24192421
if (IS_ERR(spi->dma_rx)) {
24202422
ret = PTR_ERR(spi->dma_rx);
2421-
spi->dma_rx = NULL;
2422-
if (ret == -EPROBE_DEFER)
2423+
if (ret == -ENODEV) {
2424+
dev_info(&pdev->dev, "rx dma disabled\n");
2425+
spi->dma_rx = NULL;
2426+
} else {
2427+
dev_err_probe(&pdev->dev, ret, "failed to request rx dma channel\n");
24232428
goto err_dma_release;
2424-
2425-
dev_warn(&pdev->dev, "failed to request rx dma channel\n");
2429+
}
24262430
} else {
24272431
ctrl->dma_rx = spi->dma_rx;
24282432
}

0 commit comments

Comments
 (0)