Author: gnn
Date: Thu Oct  2 15:03:51 2014
New Revision: 272411
URL: https://svnweb.freebsd.org/changeset/base/272411

Log:
  Properly handle a case that should never happen (the bus_dma
  callback being called with error set to non-zero).

Modified:
  head/sys/dev/sfxge/sfxge_dma.c

Modified: head/sys/dev/sfxge/sfxge_dma.c
==============================================================================
--- head/sys/dev/sfxge/sfxge_dma.c      Thu Oct  2 12:27:41 2014        
(r272410)
+++ head/sys/dev/sfxge/sfxge_dma.c      Thu Oct  2 15:03:51 2014        
(r272411)
@@ -164,11 +164,14 @@ sfxge_dma_alloc(struct sfxge_softc *sc, 
 
        /*
         * 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;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to