From: Maciej Sosnowski Date: Fri, 7 Nov 2008 01:45:52 +0000 (+0000) Subject: [1/4] I/OAT: fix channel resources free for not allocated channels X-Git-Tag: upstream/snapshot3+hdmi~21573^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3d4f44f50b65b0b0290e357f8739cfb3f4bcaca;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [1/4] I/OAT: fix channel resources free for not allocated channels If the ioatdma driver is loaded but not used it does not allocate descriptors. Before it frees channel resources it should first be sure that they have been previously allocated. Cc: Signed-off-by: Maciej Sosnowski Tested-by: Tom Picard Signed-off-by: Dan Williams Signed-off-by: David S. Miller --- diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index b0438c4..dbb8bbb 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c @@ -807,6 +807,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) struct ioat_desc_sw *desc, *_desc; int in_use_descs = 0; + /* Before freeing channel resources first check + * if they have been previously allocated for this channel. + */ + if (ioat_chan->desccount == 0) + return; + tasklet_disable(&ioat_chan->cleanup_task); ioat_dma_memcpy_cleanup(ioat_chan); @@ -869,6 +875,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) ioat_chan->last_completion = ioat_chan->completion_addr = 0; ioat_chan->pending = 0; ioat_chan->dmacount = 0; + ioat_chan->desccount = 0; ioat_chan->watchdog_completion = 0; ioat_chan->last_compl_desc_addr_hw = 0; ioat_chan->watchdog_tcp_cookie =