Author: arybchik
Date: Wed Mar 25 10:08:28 2015
New Revision: 280507
URL: https://svnweb.freebsd.org/changeset/base/280507

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

Modified:
  stable/10/sys/dev/sfxge/sfxge_dma.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/sfxge_dma.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 10:06:26 2015        
(r280506)
+++ stable/10/sys/dev/sfxge/sfxge_dma.c Wed Mar 25 10:08:28 2015        
(r280507)
@@ -160,11 +160,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