Re: [PATCH RFC 1/3] mmc: sdhci: add support for using external DMA devices

From: Chunyan Zhang
Date: Tue Nov 06 2018 - 21:56:39 EST


On Tue, 6 Nov 2018 at 19:16, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On 11/5/18, Chunyan Zhang <zhang.chunyan@xxxxxxxxxx> 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 <zhang.chunyan@xxxxxxxxxx>
>
> 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,

Right, will address.

> you want the warning message and also the dma_release_channel()
> which should be unconditional here.

Will address.

Thanks for the review,
Chunyan

>
> Arnd