On 11/5/18, Chunyan Zhang <[email protected]> wrote:
> Some standard SD host controller can support both external dma
> controllers as well as ADMA in which the controller acts as
> DMA master.
>
> Currently the generic SDHCI code supports ADMA/SDMA integrated into
> the host controller but does not have any support for external DMA
> controllers implemented using dmaengine meaning that custom code is
> needed for any systems that use a generic DMA controller with SDHCI.
>
> Signed-off-by: Chunyan Zhang <[email protected]>

Looks good to me overall, but I think I found one small bug:


> +     dma->rx_chan = dma_request_chan(mmc->parent, "rx");
> +     if (IS_ERR(dma->rx_chan)) {
> +             ret = PTR_ERR(dma->rx_chan);
> +             if (ret == -EPROBE_DEFER && dma->tx_chan)
> +                     dma_release_channel(dma->tx_chan);
> +
> +             dma->rx_chan = NULL;
> +             pr_warn("Failed to request RX DMA channel.\n");
> +     }

The error handling looks wrong here: if you get EPROBE_DEFER,
you want to skip the warning message. If you get any other error code,
you want the warning message and also the dma_release_channel()
which should be unconditional here.

        Arnd

Reply via email to