Properly handle a case that should never happen (the bus_dma

callback being called with error set to non-zero).
This commit is contained in:
George V. Neville-Neil 2014-10-02 15:03:51 +00:00
parent e8fa59aa5e
commit f857a2b4a0

View File

@ -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;