diff --git a/sys/dev/sfxge/sfxge_dma.c b/sys/dev/sfxge/sfxge_dma.c index 4831104e5906..e2bf171e35d8 100644 --- a/sys/dev/sfxge/sfxge_dma.c +++ b/sys/dev/sfxge/sfxge_dma.c @@ -164,11 +164,14 @@ sfxge_dma_alloc(struct sfxge_softc *sc, bus_size_t len, efsys_mem_t *esmp) /* * The callback gets error information about the mapping - * and will have set our vaddr to NULL if something went + * and will have set esm_addr to 0 if something went * wrong. */ - if (vaddr == NULL) + if (esmp->esm_addr == 0) { + bus_dmamem_free(esmp->esm_tag, esmp->esm_base, esmp->esm_map); + bus_dma_tag_destroy(esmp->esm_tag); return (ENOMEM); + } esmp->esm_base = vaddr;