提交 c3d4f44f 编写于 作者: M Maciej Sosnowski 提交者: David S. Miller

[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: <stable@kernel.org>
Signed-off-by: NMaciej Sosnowski <maciej.sosnowski@intel.com>
Tested-by: NTom Picard <tom.s.picard@intel.com>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fd0fcf5c
...@@ -807,6 +807,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) ...@@ -807,6 +807,12 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
struct ioat_desc_sw *desc, *_desc; struct ioat_desc_sw *desc, *_desc;
int in_use_descs = 0; 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); tasklet_disable(&ioat_chan->cleanup_task);
ioat_dma_memcpy_cleanup(ioat_chan); ioat_dma_memcpy_cleanup(ioat_chan);
...@@ -869,6 +875,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *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->last_completion = ioat_chan->completion_addr = 0;
ioat_chan->pending = 0; ioat_chan->pending = 0;
ioat_chan->dmacount = 0; ioat_chan->dmacount = 0;
ioat_chan->desccount = 0;
ioat_chan->watchdog_completion = 0; ioat_chan->watchdog_completion = 0;
ioat_chan->last_compl_desc_addr_hw = 0; ioat_chan->last_compl_desc_addr_hw = 0;
ioat_chan->watchdog_tcp_cookie = ioat_chan->watchdog_tcp_cookie =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册