svn commit: r347088 - head/sys/compat/linuxkpi/common/src
Hans Petter Selasky
hselasky at FreeBSD.org
Sat May 4 09:30:04 UTC 2019
Author: hselasky
Date: Sat May 4 09:30:03 2019
New Revision: 347088
URL: https://svnweb.freebsd.org/changeset/base/347088
Log:
Fix regression issue after r346645 in the LinuxKPI.
Properly handle error case when mapping DMA address fails.
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/src/linux_pci.c
Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_pci.c Sat May 4 09:28:11 2019 (r347087)
+++ head/sys/compat/linuxkpi/common/src/linux_pci.c Sat May 4 09:30:03 2019 (r347088)
@@ -480,10 +480,15 @@ linux_dma_alloc_coherent(struct device *dev, size_t si
align = PAGE_SIZE << get_order(size);
mem = (void *)kmem_alloc_contig(size, flag, 0, high, align, 0,
VM_MEMATTR_DEFAULT);
- if (mem)
+ if (mem != NULL) {
*dma_handle = linux_dma_map_phys(dev, vtophys(mem), size);
- else
+ if (*dma_handle == 0) {
+ kmem_free((vm_offset_t)mem, size);
+ mem = NULL;
+ }
+ } else {
*dma_handle = 0;
+ }
return (mem);
}
More information about the svn-src-head
mailing list