Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

busdma: Utilize kmalloc_powerof2()

  • Loading branch information...
commit 8e469b97783c14679448b8ed428d169b234b5108 1 parent 7b269c7
Sepherosa Ziehau authored
View
7 sys/platform/pc32/i386/busdma_machdep.c
@@ -573,13 +573,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
*/
maxsize = check_kmalloc(dmat, *vaddr, 0);
if (maxsize) {
- size_t size;
-
kfree(*vaddr, M_DEVBUF);
- /* XXX check for overflow? */
- for (size = 1; size <= maxsize; size <<= 1)
- ;
- *vaddr = kmalloc(size, M_DEVBUF, mflags);
+ *vaddr = kmalloc_powerof2(maxsize, M_DEVBUF, mflags);
check_kmalloc(dmat, *vaddr, 1);
}
} else {
View
7 sys/platform/pc64/x86_64/busdma_machdep.c
@@ -573,13 +573,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void **vaddr, int flags,
*/
maxsize = check_kmalloc(dmat, *vaddr, 0);
if (maxsize) {
- size_t size;
-
kfree(*vaddr, M_DEVBUF);
- /* XXX check for overflow? */
- for (size = 1; size <= maxsize; size <<= 1)
- ;
- *vaddr = kmalloc(size, M_DEVBUF, mflags);
+ *vaddr = kmalloc_powerof2(maxsize, M_DEVBUF, mflags);
check_kmalloc(dmat, *vaddr, 1);
}
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.