Skip to content

Commit

Permalink
dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
Browse files Browse the repository at this point in the history
of_dma_xlate callback can return ERR_PTR as well NULL in case of failure.

If error code is returned (not NULL) then the route should be released and
the router should not be registered for the channel.

Fixes: 56f13c0 ("dmaengine: of_dma: Support for DMA routers")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200806104928.25975-1-peter.ujfalusi@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
  • Loading branch information
Peter Ujfalusi authored and vinodkoul committed Aug 17, 2020
1 parent df841b1 commit 5b2aa9f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/dma/of-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec,
return NULL;

chan = ofdma_target->of_dma_xlate(&dma_spec_target, ofdma_target);
if (chan) {
chan->router = ofdma->dma_router;
chan->route_data = route_data;
} else {
if (IS_ERR_OR_NULL(chan)) {
ofdma->dma_router->route_free(ofdma->dma_router->dev,
route_data);
} else {
chan->router = ofdma->dma_router;
chan->route_data = route_data;
}

/*
Expand Down

0 comments on commit 5b2aa9f

Please sign in to comment.