Fix pagelist bus_dmamap_t map handling. Memory for pagelist is allocated

by bus_dmamem_alloc() which creates associated bus_dmamap_t map for us.
When this memory is freed by bus_dmamem_free(), the map is freed as well.

Thus there is no need to free it explicitly by bus_dmamap_destroy(),
which leads to double freeing.

Discussed with:	gonzo
Approved by:	kib (mentor)
This commit is contained in:
Svatopluk Kraus 2015-11-08 18:48:35 +00:00
parent ea228b482e
commit 72683266d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290553

View file

@ -542,9 +542,8 @@ create_pagelist(char __user *buf, size_t count, unsigned short type,
return 0;
failed_load:
bus_dmamap_unload(bi->pagelist_dma_tag, bi->pagelist_dma_map);
bus_dmamem_free(bi->pagelist_dma_tag, bi->pagelist, bi->pagelist_dma_map);
failed_alloc:
bus_dmamap_destroy(bi->pagelist_dma_tag, bi->pagelist_dma_map);
bus_dma_tag_destroy(bi->pagelist_dma_tag);
return err;
@ -613,7 +612,6 @@ free_pagelist(BULKINFO_T *bi, int actual)
bus_dmamap_unload(bi->pagelist_dma_tag, bi->pagelist_dma_map);
bus_dmamem_free(bi->pagelist_dma_tag, bi->pagelist, bi->pagelist_dma_map);
bus_dmamap_destroy(bi->pagelist_dma_tag, bi->pagelist_dma_map);
bus_dma_tag_destroy(bi->pagelist_dma_tag);
free(bi, M_VCPAGELIST);