Don't let hacksync() call bus_dmamap_sync(9) on DMA maps which

are not initialized. This fixes a panic on sparc64 where calling
bus_dmamap_sync(9) on NULL DMA maps is fatal.

Approved by:	sam
This commit is contained in:
Marius Strobl 2008-05-13 20:58:08 +00:00
parent 7c0cc5f941
commit a893539e95
2 changed files with 14 additions and 6 deletions

View File

@ -661,9 +661,13 @@ ehci_pcd_enable(void *v_sc)
static __inline void
hacksync(usbd_xfer_handle xfer)
{
usbd_pipe_handle pipe = xfer->pipe;
bus_dma_tag_t tag = pipe->device->bus->buffer_dmatag;
struct usb_dma_mapping *dmap = &xfer->dmamap;
bus_dma_tag_t tag;
struct usb_dma_mapping *dmap;
if (xfer->length == 0)
return;
tag = xfer->pipe->device->bus->buffer_dmatag;
dmap = &xfer->dmamap;
bus_dmamap_sync(tag, dmap->map, BUS_DMASYNC_PREWRITE);
}

View File

@ -1568,9 +1568,13 @@ ohci_device_bulk_done(usbd_xfer_handle xfer)
static __inline void
hacksync(usbd_xfer_handle xfer)
{
usbd_pipe_handle pipe = xfer->pipe;
bus_dma_tag_t tag = pipe->device->bus->buffer_dmatag;
struct usb_dma_mapping *dmap = &xfer->dmamap;
bus_dma_tag_t tag;
struct usb_dma_mapping *dmap;
if (xfer->length == 0)
return;
tag = xfer->pipe->device->bus->buffer_dmatag;
dmap = &xfer->dmamap;
bus_dmamap_sync(tag, dmap->map, BUS_DMASYNC_PREWRITE);
}