diff options
author | Maciej Sosnowski <maciej.sosnowski@intel.com> | 2008-11-06 20:45:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-10 18:00:51 -0500 |
commit | c3d4f44f50b65b0b0290e357f8739cfb3f4bcaca (patch) | |
tree | ebc00379b3eeb562a1d810e3ca92ff37bd01bc37 /drivers | |
parent | fd0fcf5c29dd0339c5f5d86eb2cbe9fdad5bcd73 (diff) |
[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: Maciej Sosnowski <maciej.sosnowski@intel.com>
Tested-by: Tom Picard <tom.s.picard@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/ioat_dma.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index b0438c4f0c30..dbb8bbb83a32 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) | |||
807 | struct ioat_desc_sw *desc, *_desc; | 807 | struct ioat_desc_sw *desc, *_desc; |
808 | int in_use_descs = 0; | 808 | int in_use_descs = 0; |
809 | 809 | ||
810 | /* Before freeing channel resources first check | ||
811 | * if they have been previously allocated for this channel. | ||
812 | */ | ||
813 | if (ioat_chan->desccount == 0) | ||
814 | return; | ||
815 | |||
810 | tasklet_disable(&ioat_chan->cleanup_task); | 816 | tasklet_disable(&ioat_chan->cleanup_task); |
811 | ioat_dma_memcpy_cleanup(ioat_chan); | 817 | ioat_dma_memcpy_cleanup(ioat_chan); |
812 | 818 | ||
@@ -869,6 +875,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan) | |||
869 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; | 875 | ioat_chan->last_completion = ioat_chan->completion_addr = 0; |
870 | ioat_chan->pending = 0; | 876 | ioat_chan->pending = 0; |
871 | ioat_chan->dmacount = 0; | 877 | ioat_chan->dmacount = 0; |
878 | ioat_chan->desccount = 0; | ||
872 | ioat_chan->watchdog_completion = 0; | 879 | ioat_chan->watchdog_completion = 0; |
873 | ioat_chan->last_compl_desc_addr_hw = 0; | 880 | ioat_chan->last_compl_desc_addr_hw = 0; |
874 | ioat_chan->watchdog_tcp_cookie = | 881 | ioat_chan->watchdog_tcp_cookie = |