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); } _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"