Skip to content

Commit e4c0e06

Browse files
shawn1221broonie
authored andcommitted
spi: rockchip: fix probe deferral handling
Use dma_request_chan instead of dma_request_slave_channel, in this case we can check EPROBE_DEFER without static warning. Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Shawn Lin <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent bb51537 commit e4c0e06

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/spi/spi-rockchip.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,23 +723,27 @@ static int rockchip_spi_probe(struct platform_device *pdev)
723723
master->transfer_one = rockchip_spi_transfer_one;
724724
master->handle_err = rockchip_spi_handle_err;
725725

726-
rs->dma_tx.ch = dma_request_slave_channel(rs->dev, "tx");
727-
if (IS_ERR_OR_NULL(rs->dma_tx.ch)) {
726+
rs->dma_tx.ch = dma_request_chan(rs->dev, "tx");
727+
if (IS_ERR(rs->dma_tx.ch)) {
728728
/* Check tx to see if we need defer probing driver */
729729
if (PTR_ERR(rs->dma_tx.ch) == -EPROBE_DEFER) {
730730
ret = -EPROBE_DEFER;
731731
goto err_get_fifo_len;
732732
}
733733
dev_warn(rs->dev, "Failed to request TX DMA channel\n");
734+
rs->dma_tx.ch = NULL;
734735
}
735736

736-
rs->dma_rx.ch = dma_request_slave_channel(rs->dev, "rx");
737-
if (!rs->dma_rx.ch) {
738-
if (rs->dma_tx.ch) {
737+
rs->dma_rx.ch = dma_request_chan(rs->dev, "rx");
738+
if (IS_ERR(rs->dma_rx.ch)) {
739+
if (PTR_ERR(rs->dma_rx.ch) == -EPROBE_DEFER) {
739740
dma_release_channel(rs->dma_tx.ch);
740741
rs->dma_tx.ch = NULL;
742+
ret = -EPROBE_DEFER;
743+
goto err_get_fifo_len;
741744
}
742745
dev_warn(rs->dev, "Failed to request RX DMA channel\n");
746+
rs->dma_rx.ch = NULL;
743747
}
744748

745749
if (rs->dma_tx.ch && rs->dma_rx.ch) {

0 commit comments

Comments
 (0)