mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-31 12:13:10 +00:00
- Don't compare bus_dma map pointers for static DMA allocations against
NULL to determine if bus_dmamap_unload() or bus_dmamem_free() should be called. Instead, check the associated bus and virtual addresses. - Don't clear static DMA maps to NULL. Reviewed by: jfv
This commit is contained in:
parent
28dfa008e9
commit
46e89834dc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=267385
@ -3088,7 +3088,6 @@ em_dma_malloc(struct adapter *adapter, bus_size_t size,
|
||||
bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
fail_0:
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_tag = NULL;
|
||||
|
||||
return (error);
|
||||
@ -3099,12 +3098,15 @@ em_dma_free(struct adapter *adapter, struct em_dma_alloc *dma)
|
||||
{
|
||||
if (dma->dma_tag == NULL)
|
||||
return;
|
||||
if (dma->dma_map != NULL) {
|
||||
if (dma->dma_paddr != 0) {
|
||||
bus_dmamap_sync(dma->dma_tag, dma->dma_map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(dma->dma_tag, dma->dma_map);
|
||||
dma->dma_paddr = 0;
|
||||
}
|
||||
if (dma->dma_vaddr != NULL) {
|
||||
bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_vaddr = NULL;
|
||||
}
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
dma->dma_tag = NULL;
|
||||
|
@ -3259,7 +3259,6 @@ igb_dma_malloc(struct adapter *adapter, bus_size_t size,
|
||||
bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
fail_0:
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_tag = NULL;
|
||||
|
||||
return (error);
|
||||
@ -3270,12 +3269,15 @@ igb_dma_free(struct adapter *adapter, struct igb_dma_alloc *dma)
|
||||
{
|
||||
if (dma->dma_tag == NULL)
|
||||
return;
|
||||
if (dma->dma_map != NULL) {
|
||||
if (dma->dma_paddr != 0) {
|
||||
bus_dmamap_sync(dma->dma_tag, dma->dma_map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(dma->dma_tag, dma->dma_map);
|
||||
dma->dma_paddr = 0;
|
||||
}
|
||||
if (dma->dma_vaddr != NULL) {
|
||||
bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_vaddr = NULL;
|
||||
}
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
dma->dma_tag = NULL;
|
||||
|
@ -2527,7 +2527,6 @@ lem_dma_malloc(struct adapter *adapter, bus_size_t size,
|
||||
bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
fail_0:
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_tag = NULL;
|
||||
|
||||
return (error);
|
||||
@ -2538,12 +2537,15 @@ lem_dma_free(struct adapter *adapter, struct em_dma_alloc *dma)
|
||||
{
|
||||
if (dma->dma_tag == NULL)
|
||||
return;
|
||||
if (dma->dma_map != NULL) {
|
||||
if (dma->dma_paddr != 0) {
|
||||
bus_dmamap_sync(dma->dma_tag, dma->dma_map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(dma->dma_tag, dma->dma_map);
|
||||
dma->dma_paddr = 0;
|
||||
}
|
||||
if (dma->dma_vaddr != NULL) {
|
||||
bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map);
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_vaddr = NULL;
|
||||
}
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
dma->dma_tag = NULL;
|
||||
|
@ -116,7 +116,6 @@ i40e_allocate_dma(struct i40e_hw *hw, struct i40e_dma_mem *dma,
|
||||
fail_1:
|
||||
bus_dma_tag_destroy(dma->tag);
|
||||
fail_0:
|
||||
dma->map = NULL;
|
||||
dma->tag = NULL;
|
||||
return (err);
|
||||
}
|
||||
|
@ -1459,7 +1459,6 @@ ixgb_dma_malloc(struct adapter * adapter, bus_size_t size,
|
||||
fail_1:
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
fail_0:
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_tag = NULL;
|
||||
return (r);
|
||||
}
|
||||
|
@ -2788,7 +2788,6 @@ ixgbe_dma_malloc(struct adapter *adapter, bus_size_t size,
|
||||
fail_1:
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
fail_0:
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_tag = NULL;
|
||||
return (r);
|
||||
}
|
||||
|
@ -1955,7 +1955,6 @@ ixv_dma_malloc(struct adapter *adapter, bus_size_t size,
|
||||
fail_1:
|
||||
bus_dma_tag_destroy(dma->dma_tag);
|
||||
fail_0:
|
||||
dma->dma_map = NULL;
|
||||
dma->dma_tag = NULL;
|
||||
return (r);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user