busdma: Free bounce zone if any error happens during bus_dma_tag_create()
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 31 Dec 2010 09:25:05 +0000 (17:25 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 8 Jan 2011 15:15:14 +0000 (23:15 +0800)
sys/platform/pc32/i386/busdma_machdep.c
sys/platform/pc64/x86_64/busdma_machdep.c

index 3a24893..b45e2d6 100644 (file)
@@ -363,10 +363,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
                }
        }
 back:
-       if (error)
+       if (error) {
+               free_bounce_zone(newtag);
                kfree(newtag, M_DEVBUF);
-       else
+       } else {
                *dmat = newtag;
+       }
        return error;
 }
 
index ed3e6aa..473030d 100644 (file)
@@ -363,10 +363,12 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
                }
        }
 back:
-       if (error)
+       if (error) {
+               free_bounce_zone(newtag);
                kfree(newtag, M_DEVBUF);
-       else
+       } else {
                *dmat = newtag;
+       }
        return error;
 }