diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 0358c05e6e8a..c5753c797735 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1218,6 +1218,11 @@ static int hcd_alloc_coherent(struct usb_bus *bus, { unsigned char *vaddr; + if (*vaddr_handle == NULL) { + WARN_ON_ONCE(1); + return -EFAULT; + } + vaddr = hcd_buffer_alloc(bus, size + sizeof(vaddr), mem_flags, dma_handle); if (!vaddr) diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2a19336c9824..2e704fa3cedf 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -629,7 +629,8 @@ static int ehci_init(struct usb_hcd *hcd) ehci->command = temp; /* Accept arbitrarily long scatter-gather lists */ - hcd->self.sg_tablesize = ~0; + if (!(hcd->driver->flags & HCD_LOCAL_MEM)) + hcd->self.sg_tablesize = ~0; return 0; }